#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define db long double

using namespace std;
//using namespace __gnu_pbds;
//using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
    int n, m, T, ans = 0; cin >> n >> m >> T;

    vector<int> a(n), pref_sm(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        pref_sm[i + 1] = pref_sm[i] + a[i];
    }

    unordered_set<int> st;
    for (int i = 0; i < m; ++i) {
        int x; cin >> x;
        st.insert(x - 1);
    }

    vector<int> ql(n, -1), qr(n, n), dq;
    for (int i = 0; i < n; ++i) {
        while (!dq.empty() && a[dq.back()] > a[i]) {
            qr[dq.back()] = i;
            dq.pop_back();
        }

        dq.push_back(i);
    }

    dq.clear();
    for (int i = n - 1; i >= 0; --i) {
        while (!dq.empty() && a[dq.back()] > a[i]) {
            ql[dq.back()] = i;
            dq.pop_back();
        }

        dq.push_back(i);
    }

    for (int i : st) {
        ans = max(ans, T / a[i]);

        int cur_price = 0;
        for (int j = i; ql[j] != -1; j = ql[j]) {
            cur_price += pref_sm[j + 1] - pref_sm[ql[j]];

            if (cur_price > T) break;

            int cur_ans = i - ql[j] + 1, sm = T - cur_price;
            cur_ans += sm / a[ql[j]];

            ans = max(ans, cur_ans);
        }

        cur_price = 0;
        for (int j = i; qr[j] != n; j = qr[j]) {
            cur_price += pref_sm[qr[j] + 1] - pref_sm[j];

            if (cur_price > T) break;

            int cur_ans = qr[j] - i + 1, sm = T - cur_price;
            cur_ans += sm / a[qr[j]];

            ans = max(ans, cur_ans);
        }
    }

    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int tt = 1;
    while (tt--) {
        solve();
        cout << "\n";
    }
}