#include <bits/stdc++.h>

using namespace std;

#define int long long

int n, m, T;

int rs(vector<int> a, vector<int> b) {
    vector<int> pr(n + 1);
    for (int i = 0; i < n; i++) {
        pr[i + 1] = pr[i] + a[i];
    }
    vector<int> st;
    vector<int> prm(n);
    for (int i = 0; i < n; i++) {
        while (!st.empty() && a[st.back()] >= a[i]) {
            st.pop_back();
        }
        if (st.empty()) {
            prm[i] = i;
        } else {
            prm[i] = st.back();
        }
        st.push_back(i);
    }
    int mx = 0;
    for (int i : b) {
        int d = pr[i + 1] - pr[prm[i] + 1];
        int cn = i - prm[i];
        int t = T - d;
        if (t >= 0) {
            mx = max(mx, cn + t / a[prm[i]]);
        }
        mx = max(mx, T / a[i]);
    }
    return mx;
}

signed main() {
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> T;
    vector<int> a(n), b(m);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i]; b[i]--;
    }
    int ans = 0;
    ans = max(ans, rs(a, b));
    reverse(a.begin(), a.end());
    for (int i = 0; i < m; i++) {
        b[i] = n - b[i] - 1;
    }
    ans = max(ans, rs(a, b));
    cout << ans;
    return 0;
}