#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#define endl '\n'
#define int long long

using namespace std;


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, m, time;
    cin >> n >> m >> time;
    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;
    int ind = 0;
    for (int i = 0; i < n; ++i) {
        if (ind < m && b[ind] <= i) {
            ind++;
        }
        if (ind > 0) {
            if ((pref[i] - pref[b[ind - 1]]) <= time) {
                ans = max(ans, i - b[ind - 1] + (time - (pref[i] - pref[b[ind - 1]])) / a[i]);
            }
        }
        if (ind < m) {
            if ((pref[b[ind] + 1] - pref[i + 1]) <= time) {
                ans = max(ans, b[ind] - i + (time - (pref[b[ind] + 1] - pref[i + 1])) / a[i]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}
