#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

auto seed = chrono::high_resolution_clock().now().time_since_epoch().count();
mt19937 rnd(seed);

template<typename T>
using orderet_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename V>
using table = gp_hash_table<T, V>;

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ld = long double;
using dd = double;

#define int ll

const ll INF = 1e18;



int f(int i, int j, int T, int mn){
    return i - j + T / mn;
}

int get_mn(int i, vector<pair<int, int>>& v){
    int n = v.size();
    int l = 0, r = n;
    while(r-l>1){
        int m = (r+l)/2;
        if(v[m].second > i) r = m;
        else l = m;
    }
    return v[l].first;
}

vector<int> get_ans(int n, vector<int> v, int T){
    vector<int> ans(n);
    int opt = -1;
    int sum = 0;
    vector<pair<int, int>> a;
    for(int i =0 ; i < n; ++i){
        int start = i;
        while(!a.empty() && a.back().first >= v[i]){
            start = a.back().second;
            a.pop_back();
        }
        a.push_back({v[i], start});
        sum += v[i];
        while(opt < i && sum > T){
            opt++;
            sum -= v[opt];
        }
        while(opt < i){
            bool c = false;
            int sum1 = sum;
            for(int j = opt + 1; j <= min(i, opt + 1000); ++j){
                sum1 -= v[j];
                if(f(i, opt, T-sum, get_mn(opt, a)) <= f(i, j, T-sum1, get_mn(j, a))){
                    opt = j;
                    sum = sum1;
                    c = true;
                }
            }
            if(!c)break;
        }
        while(opt < i && (opt == -1 || f(i, opt, T - sum, get_mn(opt, a)) <= f(i, opt+1, T-sum+v[opt+1], get_mn(opt+1, a)))){
            opt++;
            sum -= v[opt];
        }
        ans[i] = f(i, opt, T - sum, get_mn(opt, a));
    }
    return ans;
}

void solve(){
    int n, m, T;
    cin>>n>>m>>T;
    vector<int> v(n);
    for(int i = 0; i < n; ++i) cin>>v[i];
    vector<int> ans1 = get_ans(n, v, T);
    reverse(v.begin(), v.end());
    vector<int> ans2 = get_ans(n, v, T);
    reverse(ans2.begin(), ans2.end());
    int mx = 0;
    for(int i = 0; i < m; ++i){
        int j;
        cin>>j;
        mx = max(mx, max(ans1[j-1], ans2[j-1]));
    }
    cout << mx;
}

signed main(){
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    //cin>>t;
    while(t--) solve();
}