#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]);
    }
    ll ans = 0;
    for (int i = 0; i < m; i++) {
        ll b;
        cin >> b;
        b--;
        for (ll j = b; j >= 0; j--) {
            ll tt = sm[b + 1] - sm[j + 1];
            if (tt > t) {
                break;
            }
            ans = max(ans, b - j + (t - tt) / a[j]);
        }
        for (ll j = b + 1; j < n; j++) {
            ll tt = sm[j] - sm[b];
            if (tt > t) {
                break;
            }
            ans = max(ans, j - b + (t - tt) / a[j]);
        }
    }
    cout << ans;
} 