#include <bits/stdc++.h>

using namespace std;

using ll = long long;

void solve() {
    int 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 = 1; i <= n; i++) {
        pref[i] += pref[i - 1] + a[i - 1];
    }
    vector<ll> b(m);
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        b[i]--;
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ll l = 0, r = m;
        while (r - l > 1) {
            ll mid = (r + l) / 2;
            if (b[mid] <= i) l = mid;
            else r = mid;
        }
        ll x = b[l];
        ll z = 0, t = T, cnt = 0;
        if (x >= i) z = pref[x + 1] - pref[i];
        else z = pref[i + 1] - pref[x];
        if (z <= t) {
            cnt = abs(i - x) + 1;
            t -= z;
            cnt += int(t / a[i]);
            ans = max(ans, cnt);
        }
        l = -1, r = m - 1;
        while (r - l > 1) {
            ll mid = (r + l) / 2;
            if (b[mid] < i) l = mid;
            else r = mid;
        }
        x = b[r];
        z = 0, t = T, cnt = 0;
        if (x >= i) z = pref[x + 1] - pref[i];
        else z = pref[i + 1] - pref[x];
        if (z <= t) {
            cnt = abs(i - x) + 1;
            t -= z;
            cnt += int(t / a[i]);
            ans = max(ans, cnt);
        }
    }
    cout << ans;
}

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