#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

void getAns(int64_t n, int64_t T, vector<int64_t>& a, vector<int64_t>& ans) {
    ans.assign(n, 0);
    vector<int64_t> pref(n); pref[0] = a[0];
    for (int i = 1; i < n; ++i) pref[i]=pref[i-1]+a[i];
    deque<int> d;
    for (int i = 0; i < n; ++i) {
        while (!d.empty() && a[d.back()]>=a[i]) d.pop_back();
        d.push_back(i);
        int opt = 0;
        for (int j = 0; j<d.size(); ++j) {
            int64_t x = pref[i]-pref[d[j]], k = i-d[j];
            int64_t res = (T-x)/a[d[j]]+k;
            if (res > ans[i]) {
                ans[i] = res;
                opt = j;
            }
        }
        for (int j = 0; j < opt; ++j) d.pop_front();
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int64_t n, m, T;
    cin >> n >> m >> T;
    vector<int64_t> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];

    vector<int64_t> ans1;
    getAns(n, T, a, ans1);
    vector<int64_t> ans2;
    reverse(a.begin(), a.end());
    getAns(n, T, a, ans2);
    reverse(ans2.begin(), ans2.end());

    int64_t res = 0;
    for (int i = 0; i < m; ++i) {
        int j; cin >> j; --j;
        res = max(res, max(ans1[j], ans2[j]));
    }
    cout << res << '\n';

    return 0;
}
