#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> dp(n);
    for (int i = 1; i < n; i++) {
        dp[i] = dp[i - 1];


        ll l = dp[i - 1];
        ll tt = sm[i + 1] - sm[l + 1];
        ll v1 = -INF;
        if (tt <= t) {
            v1 = i - l + (t - tt) / a[l];
        }


        ll v2 = t / a[i];
        if (v2 >= v1) {
            dp[i] = i;
        }
    }

    vector<ll> dp2(n);

    dp2[n - 1] = n - 1;

    for (int i = n - 2; i >= 0; i--) {
        dp2[i] = dp2[i + 1];

        ll r = dp2[i + 1];
        ll tt = sm[r] - sm[i];
        ll v1 = -INF;
        if (tt <= t) {
            v1 = r - i + (t - tt) / a[r];
        }

        ll v2 = t / a[i];
        if (v2 >= v1) {
            dp2[i] = i;
        }
    }

    ll ans = 0;
    for (int i = 0; i < m; i++) {
        ll b;
        cin >> b;
        b--;

        ll k = dp[b];
        ll tt = sm[b + 1] - sm[k + 1];
        ans = max(ans, b - k + (t - tt) / a[k]);

        ll j = dp2[b];
        tt = sm[j] - sm[b];
        ans = max(ans, j - b + (t - tt) / a[j]);
    }
    cout << ans;
} 