#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 300001;
const int lg = 20;
int sp[lg][N];
int get(int l, int r) {
    int k = __lg(r - l);
    return min(sp[k][l], sp[k][r - (1 << k)]);
}
signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m, t; cin >> n >> m >> t;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sp[0][i] = a[i];
    }
    for (int k = 1; k < lg; k++) {
        for (int i = 0; i < n; i++) {
            sp[k][i] = min(sp[k - 1][i], sp[k - 1][i + (1 << (k - 1))]);
        }
    }
    vector<int> pref(n + 1);
    for (int i =1; i <= n; i++) {
        pref[i] = pref[i - 1] + a[i - 1];
    }
    vector<int> tme(n);
    int answer = 0;
    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        int l = i;
        int r = n + 1;
        while (r - l > 1) {
            int mid = (l + r) / 2;
            int sum = pref[mid] - pref[i];
            if (sum <= t) l = mid;
            else r = mid;
        }
        for (int j = max(i, l - 3); j <= l + 3 && j < n; j++) {
            int sum = pref[j + 1] - pref[i];
            int k = j - i + 1;
            int mn = get(i, j + 1);
            if (sum <= t) {
                ans[i] = max(ans[i], k + (t - sum) / mn);
            }
        }
        l = 0;
        r = i;
        while (r - l > 1) {
            int mid = (l + r) / 2;
            int sum = pref[mid] - pref[i];
            if (sum <= t) r = mid;
            else l = mid;
        }
        for (int j = max(0ll, l - 3); j <= l + 3 && j < i; j++) {
            int sum = pref[i + 1] - pref[j];
            int k = i - j + 1;
            int mn = get(j, i + 1);
            if (sum <= t) {
                ans[i] = max(ans[i], k + (t - sum) / mn);
            }
        }
    }
    int ey = 0;
    while (m--) {
        int o; cin >> o;
        ey = max(ey, ans[o - 1]);
    }
    cout << ey << '\n';
    return 0;
}
