#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
void solve(){
    int n, m, t;
    cin >> n >> m >> t;
    vector <int> a(n), ans(n);
    for (int i = 0; i < n; ++i){
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i){
        int sm = 0;
        int mn = INF;
        for (int j = i; j < n; ++j){
            sm += a[j];
            if (sm > t){
                break;
            }
            mn = min(mn, a[j]);
            ans[i] = max(ans[i], j - i + 1 + (t - sm) / mn);
        }
        sm = 0;
        mn = INF;
        for (int j = i; j >= 0; --j){
            sm += a[j];
            if (sm > t){
                break;
            }
            mn = min(mn, a[j]);
            ans[i] = max(ans[i], i - j + 1 + (t - sm) / mn);
        }
    }
    int mx = 0;
    for (int i = 0; i < m; ++i){
        int b;
        cin >> b;
        --b;
        mx = max(mx, ans[b]);
    }
    cout << mx;
}
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--){
        solve();
    }
}
