#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m,t;
    cin >>n >>m >>t;
    vector <int> a(n+1);
    for (int i=1; i<=n; ++i){
        cin >>a[i];
    }
    vector <int> pref(n+1);
    for (int i=1; i<=n; ++i){
        pref[i]=pref[i-1]+a[i];
    }
    vector <int> b(m);
    for (int i=0; i<m; ++i){
        cin >>b[i];
    }
    int ans=0;
    int idx=0;
    for (int i=b[0]; i<=n; ++i){
        while (idx<m-1 && b[idx]<=i){
            idx++;
        }
        if (b[idx]>i)
            idx--;
        int it=(t-pref[i-1]+pref[b[idx]-1])/a[i];
        if (it<=0)
            continue;
        it+=i-b[idx];
        ans=max(ans,it);
    }
    a.push_back(0);
    reverse(a.begin(), a.end());
    pref.clear();
    pref.resize(n+1,0);
    for (int i=1; i<=n; ++i){
        pref[i]=pref[i-1]+a[i];
    }
    reverse(b.begin(), b.end());
    for (int i=0; i<m; ++i){
        b[i]=n+1-b[i];
    }
    idx=0;
    for (int i=b[0]; i<=n; ++i){
        while (idx<m-1 && b[idx]<=i){
            idx++;
        }
        if (b[idx]>i)
            idx--;
        int it=(t-pref[i-1]+pref[b[idx]-1])/a[i];
        if (it<=0)
            continue;
        it+=i-b[idx];
        ans=max(ans,it);
    }
    cout <<ans;
}

