#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define fi first
#define se second
const ll inf = 1e17 + 7;


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> pref(n + 1);
    for(int i = 0; i < n; ++i) {
        pref[i + 1] = pref[i] + a[i];
    }
    vector<ll> b(m);
    for(int i = 0; i < m; ++i) {
        cin >> b[i];
    }
    ll res = 0;
    ll pos = -1;
    for(int i = 0; i < n; ++i) {
        while(pos + 1 < m && b[pos + 1] <= i + 1) {
            pos++;
        }
        if (pos != -1) {
            ll ost = t - (pref[i] - pref[b[pos] - 1]);
            if (ost >= 0) {
                //cout << i << ' ' << ost / a[i] + (i - b[pos] + 1) << ' ' << b[pos] << '\n';
                res = max(res, ost / a[i] + (i - b[pos] + 1));
            }
        }
    }
    pos = m;
    for(int i = n - 1; i >= 0; --i) {
        while(pos - 1 >= 0 && b[pos - 1] >= i + 1) {
            pos--;
        }
        if (pos != m) {
            ll ost = t - (pref[b[pos]] - pref[i + 1]);
            if (ost >= 0) {
                //cout << i << ' ' << ost / a[i] + (i - b[pos] + 1) << ' ' << b[pos] << '\n';
                res = max(res, ost / a[i] + (b[pos] - 1 - i));
            }
        }
    }
    cout << res;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll T = 1;
    //cin >> T;
    while(T--) {
        solve();
        cout << '\n';
    }
    return 0;
}
