//#define _GLIBCXX_DEBUG
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")

#include<bits/stdc++.h>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<ext/pb_ds/assoc_container.hpp>
using ll = long long;
#define int ll
using namespace std;
//using namespace __gnu_pbds;
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
//mt19937 mt(52);
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
vector<int> a, ps;
int T;
int gps(int i, int j){
    if(i > j) return 0;
    return ps[j]-(i > 0 ? ps[i-1] : 0);
}
int sc(int j, int i){
    if(gps(j+1, i) > T) return 0;
    return (i-j)+(T-gps(j+1, i))/a[j];
}
void solve() {
    int n, m;
    cin >> n >> m >> T;
    unordered_set<int> b;
    a.resize(n);
    for(auto &el : a) cin >> el;
    ps = a;
    for(int i=1; i<n; ++i) ps[i] += ps[i-1];
    for(int i=0; i<m; ++i) {
        int el;
        cin >> el;
        el--;
        b.insert(el);
    }
    int ans=0;
    int j = 0;
    for(int i=0; i<n; ++i){
        if(sc(j, i) <= sc(i, i)) j = i;
        if(b.find(i) != b.end())ans = max(ans, sc(j, i));
    }
    reverse(a.begin(), a.end());
    ps = a;
    for(int i=1; i<n; ++i) ps[i] += ps[i-1];
    //for(auto &el : b) el = n-1-el;
    unordered_set<int> nb;
    for(auto &el : b) nb.insert(n-1-el);
    b = nb;
    //reverse(b.begin(), b.end());
    j = 0;
    for(int i=0; i<n; ++i){
        if(sc(j, i) <= sc(i, i)) j = i;
        if(b.find(i) != b.end())ans = max(ans, sc(j, i));
    }
    cout << ans;
}


signed main(){
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    bool cfmode = !(42);
    if(cfmode){
        int t;
        cin >> t;
        while(t--){
            solve();
            cout << '\n';
        }
    } else solve();
}