#include <bits/stdc++.h>
using namespace std;
#define int long long
const long long INF = 1e18, MOD = 1e9 + 7;

void solve();

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m, t;
    cin >> n >> m >> t;
    vector <int> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    /*vector <int> z(n);
    for (int i = 0; i < n; i++){
        z[i] = t - (t / a[i]) * a[i] + a[i];
    }*/
    vector <int> mx(n);
    mx[0] = t / a[0];
    int pos = 0, sm = 0;
    for (int i = 1; i < n; i++){
        if (t / a[i] <= t / a[i - 1]){
            sm += a[i];
            while (sm > t){
                pos++;
                sm -= a[pos];
            }
            mx[i] = max(mx[i], i - pos + (t - sm) / a[pos]);
        }
        else{
            sm = 0;
            pos = i;
            mx[i] = max(mx[i], t / a[i]);
        }
    }
    pos = n - 1, sm = 0;
    mx[n - 1] = max(mx[n - 1], t / a[n - 1]);
    for (int i = n - 2; i > -1; i--){
        if (t / a[i] <= t / a[i + 1]){
            sm += a[i];
            while (sm > t){
                pos--;
                sm -= a[pos];
            }
            mx[i] = max(mx[i], pos - i + (t - sm) / a[pos]);
        }
        else{
            sm = 0;
            pos = i;
            mx[i] = max(mx[i], t / a[i]);
        }
    }
    /*for (auto x : mx){
        cout << x << " ";
    }
    cout << "\n";*/
    int ans = 0;
    for (int i = 0; i < m; i++){
        int x;
        cin >> x;
        x--;
        ans = max(ans, mx[x]);
    }
    cout << ans;
}
