#include <bits/stdc++.h>
#define pb push_back
#define endl "\n"
// #define int long long
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;





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 inf = 1e9;
    int ans = 0;
    for (int j = 0; j < m; ++j){
        int cnt = 0;
        int d = 0;
        for (int x = b[j]; x >= 0 && (j == 0 || x > b[j - 1]); --x){
            ans = max(ans, (t - d) / a[x] + cnt);
            d += a[x];
            cnt += 1;
        }
    }

    for (int j = 0; j < m; ++j){
        int cnt = 0;
        int d = 0;
        for (int x = b[j]; x < n && (j == m - 1 || x < b[j + 1]); ++x){
            ans = max(ans, (t - d) / a[x] + cnt);
            d += a[x];
            cnt += 1;
        }
    }
    cout << ans << endl;

}



signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t = 1;
    // cin >> t;
    while (t--){
        solve();
    }
}