#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#include <random>
using namespace std;

#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define pub push_back
#define pob pop_back
#define for0(i,n) for(ll i = 0; i < ll(n); i++)

typedef long long ll;
typedef double long dl;
typedef vector<ll> vll;
typedef vector<pair<ll,ll>> vpll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


template<typename T1, typename T2>
ostream& operator <<(ostream& out, pair<T1, T2>& a){
    out << a.fi << " " << a.se << endl;
    return out;
}

template<typename T1, typename T2>
istream& operator <<(istream& in, pair<T1, T2>& a){
    in >> a.fi >> a.se;
    return in;
}

template<typename T>
istream& operator >>(istream& in, vector<T>& a){
    for(T& ai : a) in >> ai;
    return in;
}

template<typename T>
ostream& operator <<(ostream& out, vector<T>& a){
    for(T& ai : a) out << ai << " ";
    return out;
}

template<typename T>
istream& operator >>(istream& in, vector<vector<T>>& a){
    for(vector<T>& ai : a){
        for(T& aii : ai) in >> aii;
    }
    return in;
}

template<typename T>
ostream& operator <<(ostream& out, vector<vector<T>>& a){
    for(vector<T>& ai : a){
        for(T& aii : ai) out << aii << " ";
        out << endl;
    }
    return out;
}

int n, m, t;
const int FIND = 150;

void solve(){
    cin >> n >> m >> t;
    vll a(n);
    cin >> a;
    vi b(m);
    for0(i,m){
        cin >> b[i];
        b[i]--;
    }
    vvll ans(n, vll(2));

    vll prefs(n+1);
    for(int i = 1; i <= n; i++){
        prefs[i] = prefs[i-1] + a[i-1];
    }
    int lastj = -1;
    int bestj = -1;
    ll bestans = -1;
    set<pair<ll, ll>> cache;
    for(int i = 0; i < n; i++){
        pair<ll, ll> el = {a[i], i};

        if (i > bestj){
            bestj = i;
        }
        if (i > lastj){
            cache.insert({a[i], i});
            lastj = i;
        }

        ll ost = t-prefs[bestj]+prefs[i];
        if (ost <= 0) bestans = 0;
        else bestans = bestj-i+ost/a[bestj];

        for(int j = lastj+1; j < n; j++){
            ll ost = t-prefs[j]+prefs[i];
            if (ost <= 0){
                lastj = j-1;
                break;
            }
            cache.insert({a[j], j});
            ll curans = j-i+ost/a[j];
            if (curans > bestans){
                bestans = curans;
                bestj = j;
            }
        }
        while(cache.size() >= FIND){
            auto it = cache.end();
            it--;
            cache.erase(*it);
        }
        ans[i][0] = bestans;
        for (const pair<ll, ll>& el : cache){
            int j = el.se;
            ll ost = t-prefs[j]+prefs[i];
            if (ost <= 0){
                continue;
            }
            ll curans = j-i+ost/a[j];
            if (curans > bestans){
                bestans = curans;
                bestj = j;
            }
            ans[i][0] = max(ans[i][0], curans);
        }
        if (cache.find(el) != cache.end()){
            cache.erase(el);
        }
    }

    cache.clear();
    reverse(all(a));
    prefs = vll(n+1);
    for(int i = 1; i <= n; i++){
        prefs[i] = prefs[i-1] + a[i-1];
    }
    lastj = -1;
    bestj = -1;
    bestans = -1;
    for(int i = 0; i < n; i++){
        pair<ll, ll> el = {a[i], i};

        if (i > bestj){
            bestj = i;
        }
        if (i > lastj){
            cache.insert({a[i], i});
            lastj = i;
        }

        ll ost = t-prefs[bestj]+prefs[i];
        if (ost <= 0) bestans = 0;
        else bestans = bestj-i+ost/a[bestj];

        for(int j = lastj+1; j < n; j++){
            ll ost = t-prefs[j]+prefs[i];
            if (ost <= 0){
                lastj = j-1;
                break;
            }
            cache.insert({a[j], j});
            ll curans = j-i+ost/a[j];
            if (curans > bestans){
                bestans = curans;
                bestj = j;
            }
        }
        while(cache.size() >= FIND){
            auto it = cache.end();
            it--;
            cache.erase(*it);
        }
        ans[n-i-1][1] = bestans;
        for (const pair<ll, ll>& el : cache){
            int j = el.se;
            ll ost = t-prefs[j]+prefs[i];
            if (ost <= 0){
                continue;
            }
            ll curans = j-i+ost/a[j];
            if (curans > bestans){
                bestans = curans;
                bestj = j;
            }
            ans[n-i-1][1] = max(ans[n-i-1][1], curans);
        }
        if (cache.find(el) != cache.end()){
            cache.erase(el);
        }
    }
    //cout << ans << endl;
    ll out = -1;
    for0(bi,m){
        out = max(out, max(ans[b[bi]][0], ans[b[bi]][1]));
    }
    cout << out << endl;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}
/*
5 3 10
4 5 2 7 1
1 2 4

4 2 11
4 5 7 10
2 3
*/
