#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];
    }
    ll ans = -1;
    for (int j = 0; j < m; j++) {
        int x;
        cin >> x;
        x--;
        for (int i = 0; i < n; i++) {
            ll z = 0, t = T;
            ll 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;
}
