#include <bits/stdc++.h>

using namespace std;

#define int long long

int32_t main()
{
    int n, m, t;
    cin >> n >> m >> t;
    int a[n + 1], b[m + 1];
    for(int i = 1;i <= n;i++){
        cin >> a[i];
    }
    b[0] = 0;
    b[m + 1] = n + 1;
    int ans = 0;
    for(int i = 1;i <= m;i++){
        cin >> b[i];
    }
    for(int i = 1;i <= m;i++){
        int s = 0, vr = 0;
        for(int j = b[i];j > b[i - 1];j--){
            ans = max(ans, (t - vr) / a[j] + s);
            s += 1;
            vr += a[j];
            if(s > t){
                break;
            }
        }
        s = 0;
        vr = 0;
        for(int j = b[i];j < b[i + 1];j++){
            ans = max(ans, (t - vr) / a[j] + s);
            s += 1;
            vr += a[j];
            if(s > t){
                break;
            }
        }
    }
    cout << ans;

    return 0;
}
