#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;
template <typename T>
ll sz(T& a) {
    return (ll)a.size();
}





int main() {
//    cout.setf(ios::fixed); cout.precision(15);
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#ifdef manix888
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif


    int n, m; ll t;
    cin >> n >> m >> t;
    vector<ll> nums(n);
    for (int i=0; i<n; i++) cin >> nums[i];
    ll dora = *max_element(nums.begin(), nums.end());

    vector<ll> prefs(n+1);
    for (int i=1; i<=n; i++) prefs[i] = prefs[i-1] + nums[i-1];

    if (dora <= 20) {
        vector<ll> anses(n, -1e18);
        deque<int> lefts;
        for (int i=0; i<n; i++) {
            while (sz(lefts) && nums[lefts.back()] >= nums[i]) lefts.pop_back();
            lefts.push_back(i);
    
            while (sz(lefts)) {
                if (prefs[i+1] - prefs[lefts.front()] > t) lefts.pop_front();
                else break;
            }
            if (sz(lefts) == 0) anses[i] = max(anses[i], 0ll);
            else {
                ll now = (i-lefts.front()+1) + (t-(prefs[i+1]-prefs[lefts.front()]))/nums[lefts.front()];
                while (sz(lefts)>=2 && (i-lefts[1]+1) + (t-(prefs[i+1]-prefs[lefts[1]]))/nums[lefts[1]] >= now) {
                    now = (i-lefts[1]+1) + (t-(prefs[i+1]-prefs[lefts[1]]))/nums[lefts[1]];
                    lefts.pop_front();
                }
                anses[i] = max(anses[i], now);
            }
        }
    
        deque<int> rights;
        for (int i=n-1; i>=0; i--) {
            while (sz(rights) && nums[rights.back()] >= nums[i]) rights.pop_back();
            rights.push_back(i);
    
            while (sz(rights)) {
                if (prefs[rights.front()+1] - prefs[i] > t) rights.pop_front();
                else break;
            }
            if (sz(rights) == 0) anses[i] = max(anses[i], 0ll);
            else {
                ll now = (rights[0]-i+1) + (t-(prefs[rights[0]+1]-prefs[i]))/nums[rights[0]];
                while (sz(rights)>=2 && (rights[1]-i+1) + (t-(prefs[rights[1]+1]-prefs[i]))/nums[rights[1]] >= now) {
                    now = (t-(prefs[rights[1]+1]-prefs[i]))/nums[rights[1]];
                    rights.pop_front();
                }
                anses[i] = max(anses[i], now);
            }
        }
    
        ll mxans = -1e18;
        for (int i=0; i<m; i++) {
            int x; cin >> x; x--;
            mxans = max(mxans, anses[x]);
        }
        cout << mxans;
    }
    else {
        vector<int> lefts(n); lefts[0] = 0;
        for (int i=1; i<n; i++) {
            if (nums[i-1]<=nums[i]) lefts[i] = lefts[i-1];
            else lefts[i] = i;
        }
        vector<int> rights(n); rights[n-1] = n-1;
        for (int i=n-2; i>=0; i--) {
            if (nums[i]>=nums[i+1]) rights[i] = rights[i+1];
            else rights[i] = i;
        }
        ll mxans = -1e18;
        while (m--) {
            int st; cin >> st; st--;
            // left
            {
                int fin = lefts[st];
                if (prefs[st+1]-prefs[fin] > t) {
                    if (nums[st]>t) mxans=max(mxans, 0ll);
                    else {
                        int l=fin, r=st;
                        while (l+1 < r) {
                            int mid = (l+r) / 2;
                            if (prefs[st+1]-prefs[mid] <= t) r=mid;
                            else l=mid;
                        }
                        mxans = max(mxans, (ll)st-r+1);
                    }
                }
                else {
                    ll ans = st-fin+1;
                    ll ost = t - (prefs[st+1]-prefs[fin]);
                    ans += ost/nums[fin];
                    mxans = max(ans, mxans);
                }
            }
            // right
            {
                int fin = rights[st];
                if (prefs[fin+1]-prefs[st] > t) {
                    if (nums[st]>t) mxans = max(mxans, 0ll);
                    else {
                        int l=st, r=fin;
                        while (l+1 < r) {
                            int mid = (l+r) / 2;
                            if (prefs[mid+1]-prefs[st] <= t) l=mid;
                            else r=mid;
                        }
                        mxans = max(mxans, (ll)l-st+1);
                    }
                }
                else {
                    ll ans = fin-st+1;
                    ll ost = t - (prefs[fin+1]-prefs[st]);
                    ans += ost/nums[fin];
                    mxans = max(ans, mxans);
                }
            }
        }
    
        cout << mxans;
    }


    return 0;
}
