#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using ll = long long;
using ld = long double;
#define all(array) array.begin(), array.end()
constexpr long long INF =  (long long)2e18 + 1;
constexpr ll inf = 1e9 + 1;
const ll mod = 1e9 + 7;



void solve(){
    ll n, m, t;
    cin >> n >> m >> t;
    vector<ll> a(n);
    vector<ll> v(m);
    for(int i = 0 ;i < n; ++i){
        cin >> a[i];
    }
    for(int i = 0 ; i  < m; ++i){
        cin >> v[i];
        v[i]--;
    }
    ll ind = 0;
    vector<ll> pref(n + 1);
    for(int i = 1 ; i <= n; ++i){
        pref[i] = pref[i-1] + a[i-1];
    }
    ll ans = 0;
    for(int i = v[0] ; i < n; ++i){
        if(ind < m && v[ind+1] == i){ind++;}
        ll cur = pref[i+ 1] - pref[v[ind]];
        ll temp= t - cur;
        if(temp >= 0){
            ans = max(ans, i+1-v[ind] + temp/ a[i]);
        }
    }
    ind = m-1;
    for(int i = v[m-1] ; i >=0 ; --i){
        if(ind >0 && v[ind-1] == i){ind--;}
        ll cur = pref[v[ind]+ 1] - pref[i];
        ll temp= t - cur;
        if(temp >= 0){
            ans = max(ans, v[ind]+1-i + temp/ a[i]);
        }
    }
    cout << ans;
}


signed main(){
    fast;;;
    long long tc = 1;
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    //cin >> tc;
#endif
    while(tc--){
        solve()
                ;
        cout << "\n";
    }


}