#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
constexpr int INF = 1e18;
constexpr int MOD = 1e9 + 7;
//mt19937_64 rnd(0);


void solve() {
    int n, m, t;
    cin >> n >> m >> t;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> pref(n + 1);
    for (int i = 0; i < n; ++i) {
        pref[i + 1] = pref[i] + a[i];
    }
    vector<int> b(m);
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
        b[i]--;
    }
    int j = 0, ans = 0;
    for (int i = 0; i < n; ++i) {
        if (j > 0) {
            if (t >= pref[i] - pref[b[j - 1]]) {
                ans = max(ans, i - b[j - 1] + (t - pref[i] + pref[b[j - 1]]) / a[i]);
            }
        }
        if (j != m) {
            if (t >= pref[b[j] + 1] - pref[i + 1]) {
                ans = max(ans, b[j] - i + (t - pref[b[j] + 1] + pref[i + 1]) / a[i]);
            }
        }
        if (b[j] == i) {
            j++;
        }
    }
    cout << ans << "\n";
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
#ifdef MULTY
    cin >> t;
#endif
    while (t--) {
        solve();
    }

    return 0;
}