#include<bits/stdc++.h>

#define int long long

using namespace std;

signed main() {
    int n, m, t;
    cin >> n >> m >> t;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector<int> b(m);
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
        --b[i];
    }
    vector<int> pref(n + 1);
    for (int i = 0; i < n; ++i) {
        pref[i + 1] = pref[i] + a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int j1 = lower_bound(b.begin(), b.end(), i) - b.begin();
        int j2 = j1 - 1;
        if (0 <= j1 && j1 < m) {
            int x = b[j1];
            if (pref[x + 1] - pref[i + 1] <= t) {
                ans = max(ans, (t - (pref[x + 1] - pref[i + 1])) / a[i] + x - i);
            }
        }
        if (0 <= j2 && j2 < m) {
            int x = b[j2];
            //cout << pref[i] - pref[x] << " ";
            if (pref[i] - pref[x] <= t) {
                ans = max(ans, (t - (pref[i] - pref[x])) / a[i] + i - x);
            }
        }
        //cout << i << " " << j1 << " " << j2 << " " << ans << endl;
    }
    cout << ans << endl;
    return 0;
}
