#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void solve();

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll q = 1;
    while (q--) {
        solve();
    }
}

const ll INF = 1e18;

void solve() {
    ll n, m, t;
    cin >> n >> m >> t;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<ll> sm = {0};
    for (int i = 0; i < n; i++) {
        sm.push_back(sm.back() + a[i]);
    }
    vector<ll> c;
    for (int i = 0; i < m; i++) {
        ll x;
        cin >> x;
        x--;
        c.push_back(x);
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ll l = upper_bound(c.begin(), c.end(), i) - c.begin();
        if (l < c.size()) {
            ll r = c[l];
            if (sm[r + 1] - sm[i + 1] >= 0) {
            ans = max(ans, r - i + (t - (sm[r + 1] - sm[i + 1])) / a[i]);
            }
        }
        l--;
        if (l >= 0) {
            l = c[l];
            if (sm[i] - sm[l] >= 0) {
            ans = max(ans, i - l + (t - (sm[i] - sm[l])) / a[i]);
            }
        }
    }
    cout << ans;
} 