#include <bits/stdc++.h>

using namespace std;

void solve();

//#pragma GCC optimize("O3","Ofast","fastmath","unroll-loops")
//#pragma GCC target("avx2","sse4.2","bmi","lzcnt","popcnt")
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

#define int long long
#define endl '\n'
const int N = 3e5 + 10, INF = 2e18, MOD = 1e9 + 7;

void solve() {
    int n,m,t;
    cin>>n>>m>>t;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    vector<int> b(m);
    for(int i=0;i<m;i++){
        cin>>b[i];
        b[i]--;
    }
    int ans=0;

    for(int i=0;i<m;i++){
        int tme=0,cnt=0;
        int l=0;
        if(i-1>=0)l=b[i-1];
        for(int j=b[i];j>=l;j--){
            if(tme>t)break;
            ans=max(ans,(b[i]-j)+(t-tme)/a[j]);
            tme+=a[j];
        }
        tme=0;
        int r=n-1;
        if(i+1<m)r=b[i+1];
        for(int j=b[i];j<=r;j++){
            if(tme>t)break;
            ans=max(ans,(j-b[i])+(t-tme)/a[j]);
            tme+=a[j];
        }
    }
    cout<<ans<<endl;
}