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

#pragma GCC optimize("O3")

using namespace std;
//using namespace __gnu_pbds;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define int long long

//typedef tree<int, null_type,less<int>,  rb_tree_tag, tree_order_statistics_node_update> ordered_set;

signed main(){
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
    int n, m, T;
    cin>>n>>m>>T;
    vector<int> a(n);
    for(auto &x:a) cin>>x;
    vector<int> pr(n+1);
    for(int i = 1; i <= n; ++i){
        pr[i] = pr[i-1] + a[i-1];
    }
    vector<int> b(m);
    for(auto &x:b) cin>>x, --x;
    vector<int> R(n);
    for(int i = n - 1; i >= 0; --i){
        R[i] = i + 1;
        while(R[i] < n && a[R[i]] >= a[i]){
            R[i] = R[R[i]];
        }
    }
    vector<int> L(n);
    for(int i = 0; i < n; ++i){
        L[i] = i - 1;
        while(L[i] >= 0 && a[L[i]] >= a[i]){
            L[i] = L[L[i]];
        }
    }
    int ans = 0;
    for(int i:b){
        ans=max(ans, T/a[i]);
        int gg = 1000;
        for(int j = i; gg-- && j >= 0; j = L[j]){
            int s = pr[i+1] - pr[j];
            if (s > T) break;
            ans = max(ans, i - j + 1 + (T-s)/a[j]);
        }
        gg = 1000;
        for(int j = i; gg-- && j < n; j = R[j]){
            int s = pr[j+1] - pr[i];
            if (s > T) break;
            ans = max(ans, j - i + 1 + (T-s)/a[j]);
        }
    }
    cout<<ans<<'\n';
    return 0;
}
