#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 + 10);
    vector<int> us(n);
    for (int i = 0; i < n; i++) {
        pr[i + 1] = pr[i] + a[i];
    }
    for (int i : b) us[i] = 1;
    vector<int> st;
    int mx = 0;
    for (int i = 0; i < n; i++) {
        while (!st.empty() && a[st.back()] >= a[i]) {
            st.pop_back();
        }
        st.push_back(i);
        if (us[i]) {
            int cb = 0;
            int sz = (int) st.size();
            for (int h = 0; h < min(sz, (int) 2700); h++) {
                int j = h;
                int d = pr[i + 1] - pr[j + 1];
                int cn = i - j;
                int t = T - d;
                if (t >= 0) {
                    mx = max(mx, cn + t / a[j]);
                }
                cb++;
            }
            for (int h = 0; h < min(sz, (int) 500); h++) {
                int j = sz - h - 1;
                int d = pr[i + 1] - pr[j + 1];
                int cn = i - j;
                int t = T - d;
                if (t >= 0) {
                    mx = max(mx, cn + t / a[j]);
                }
                cb++;
            }
            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;
}