#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll n,m,T,a[300002],i,j,pr[300002],x,ans;
signed main(){
    cin >> n >> m >> T;
    for(i=1;i<=n;i++){
        cin >> a[i];
        pr[i]=pr[i-1]+a[i];
    }
    for(i=1; i<=m;i++){
        cin >> x;
        ans=max(ans,T/a[x]);
        for(j=x-1;j>=1;j--){
            if(T>=pr[x]-pr[j]){
            ans=max(ans,x-j+(T-(pr[x]-pr[j]))/a[j]);
            }else{
                break;
            }
        }
        for(j=x+1;j<=n;j++){
            if(T>=pr[j-1]-pr[x-1]){
            ans=max(ans,j-x+(T-(pr[j-1]-pr[x-1]))/a[j]);
            }else{
                break;
            }
        }
    }
    cout << ans;
    return 0;
}