#ifndef SEREGA
#include <bits/allocator.h>
#pragma GCC target("avx2,popcnt")
#pragma GCC optimize("O3,no-stack-protector")
#endif
#include <bits/stdc++.h>
using namespace std;
#define int int64_t

void solve() {
    int n, m, T;
    cin >> n >> m >> T;
    vector<int> a(n + 1);
    vector<int> pref(n + 1);
    vector<int> answers(n + 1);
    auto get = [&](int i, int j) -> int {
        if (j <= i) {
            if (pref[i] - pref[j] <= T) {
                return (T - (pref[i] - pref[j])) / a[j] + (i - j);
            }
        } else {
            if (pref[j - 1] - pref[i - 1] <= T) {
                return (T - (pref[j - 1] - pref[i - 1])) / a[j] + (j - i);
            }
        }
        return INT_MIN;
    };
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        pref[i] = pref[i - 1] + a[i];
    }
    for (int i = 1; i <= n; ++i) {
        int mxnow = INT_MIN;
        for (int j = 1; j <= n; ++j) {
            mxnow = max(mxnow, get(i, j));
        }
        answers[i] = mxnow;
    }
    // for (int i = 1; i <= n; ++i) {
        //     cout << answers[i] << ' ';
        // }
        // cout << endl;
    int mx = INT_MIN;
    for (int i = 0; i < m; ++i) {
        int b;
        cin >> b;
        mx = max(mx, answers[b]);
    }
    cout << mx << endl;

}

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