#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18;
void solve(){
    /*vector <int> a = {10, 9,9, 9, 9,9};
    for (int t = 6; t < 100; ++t){
        int sm = 0;
        cout << t << ": ";
        for (int i = 0; i < 6; ++i){
            if (t < sm){
                cout << 0 << " ";
                continue;
            }
            cout << i + (t - sm) / a[i] << " ";
            sm += a[i];
        }

        cout << endl;
    }*/
    int n, m, t;
    cin >> n >> m >> t;
    vector <int> a(n), ans(n), pref(n + 1);
    for (int i = 0; i < n; ++i){
        cin >> a[i];
        pref[i + 1] = pref[i] + a[i];
    }
    deque <int> dq;
    for (int i = n - 1; i >= 0; --i){
        while (!dq.empty() && a[dq.back()] >= a[i]){
            dq.pop_back();
        }
        while (!dq.empty() && pref[dq.front() + 1] - pref[i] > t){
            dq.pop_front();
        }
        while (dq.size() > 1 && (dq.front() - i + 1 +(t - (pref[dq.front() + 1] - pref[i])) / a[dq.front()]) < dq[1] - i + 1 +(t - (pref[dq[1] + 1] - pref[i])) / a[dq[1]]){
            dq.pop_front();
        }
        if (a[i] <= t){
           dq.push_back(i);
        }
        if (!dq.empty()){
            ans[i] = max(ans[i], dq.front() - i + 1 +(t - (pref[dq.front() + 1] - pref[i])) / a[dq.front()]);
        }
        if (dq.size() > 1){
            ans[i] = max(ans[i], dq[1] - i + 1 +(t - (pref[dq[1] + 1] - pref[i])) / a[dq[1]]);
        }
        //dq.push_back(i);

    }

    dq.clear();
    for (int i =  0; i< n; ++i){
        while (!dq.empty() && a[dq.back()] >= a[i]){
            dq.pop_back();
        }
        while (!dq.empty() && pref[i + 1] - pref[dq.front()] > t){
            dq.pop_front();
        }
        while (dq.size() > 1 && (i - dq.front() + 1 +(t - (-pref[dq.front()] + pref[i + 1])) / a[dq.front()]) < i - dq[1] + 1 +(t - (-pref[dq[1]] + pref[i + 1])) / a[dq[1]]){
            dq.pop_front();
        }
        if (a[i] <= t){
           dq.push_back(i);
        }
        if (!dq.empty()){
            ans[i] = max(ans[i], i - dq.front() + 1 + (t - (pref[i + 1] - pref[dq.front()])) / a[dq.front()]);
        }
        if (dq.size() > 1){
            ans[i] = max(ans[i], i - dq[1] + 1 + (t - (pref[i + 1] - pref[dq[1]])) / a[dq[1]]);
        }

    }
    for (auto x: ans){
       // cout << x << " ";
    }
    //cout << endl;
    /*for (int i = 0; i < n; ++i){
        int sm = 0;
        int mn = INF;
        for (int j = i; j < n; ++j){
            sm += a[j];
            if (sm > t){
                break;
            }
            mn = min(mn, a[j]);
            ans[i] = max(ans[i], j - i + 1 + (t - sm) / mn);
        }
        sm = 0;
        mn = INF;
        for (int j = i; j >= 0; --j){
            sm += a[j];
            if (sm > t){
                break;
            }
            mn = min(mn, a[j]);
            ans[i] = max(ans[i], i - j + 1 + (t - sm) / mn);
        }
    }*/
    int mx = 0;
    for (int i = 0; i < m; ++i){
        int b;
        cin >> b;
        --b;
        mx = max(mx, ans[b]);
    }
    cout << mx;
}
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--){
        solve();
    }
}
