#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
signed main(){
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m, t;
    cin>>n>>m>>t;
    vector <int> a(n), pr(n + 1);
    vector <int> b(m);
    for (int i = 0; i < n; i++){
        cin>>a[i];
        pr[i + 1] = pr[i] + a[i];
    }
    for (int i = 0; i < m; i++){
        cin>>b[i];
        b[i]--;
    }
    vector <int> time(n, 0);
    for (int i = 0, dist; i < n; i++){
        auto left = upper_bound(b.begin(), b.end(), i);
        if (left != b.begin()){
            left--;
            dist = pr[i] - pr[*left];
            if (dist < t){
              time[i] = max(time[i], (t - dist) / a[i] + i - *left);  
            }
            
        }
        auto right = upper_bound(b.begin(), b.end(), i);
        if (right != b.end()){
            dist = pr[*right + 1] - pr[i + 1];
            if (dist < t){
                time[i] = max(time[i], (t - dist) / a[i] + *right - i);
            }
            
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++){
        ans = max(ans, time[i]);
    }
    cout<<ans<<endl;
    
}