#include <bits/stdc++.h>

using namespace std;
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef long long ll;

void solve();

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int tt = 1; //cin >> tt;
    while (tt--) {
        solve();
        cout << "\n";
    }
}

void solve() {
    int n, m, T; cin >> n >> m >> T;
    vector<ll> a(n + 1), pref(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        pref[i] = pref[i - 1] + a[i];
    }

    vector<int> b(m);
    for (int i = 0; i < m; i++) cin >> b[i];
    sort(all(b));

    if (n == m) {
        ll mn = a[1];
        for (int i = 1; i <= n; i++) mn = min(mn, a[i]);
        cout << T / mn;
        return;
    }

    ll mx = 0;
    int r = 0;
    for (int i = 1; i <= n; i++) {
        while (r < m && b[r] < i) r++;
        int l = r - 1;
        if (r < m && pref[b[r]] - pref[i - 1] <= T) mx = max(mx, b[r] - i + 1 + (T - (pref[b[r]] - pref[i - 1])) / a[i]);
        if (l >= 0 && pref[i] - pref[b[l] - 1] <= T) mx = max(mx, i - b[l] + 1 + (T - (pref[i] - pref[b[l] - 1])) / a[i]);
    }

    cout << mx;
}
