#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

// #define FILE
#define int long long



signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef FILE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m, T;
    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]--;
    }
    vector<int> left(n), right(n);
    stack<int> st;
    for (int i = 0; i < n; ++i) {
        while (!st.empty() && a[st.top()] >= a[i]) {
            st.pop();
        }
        if (st.empty()) {
            left[i] = -1;
        } else {
            left[i] = st.top();
        }
        st.push(i);
    }
    while (!st.empty()) st.pop();
    for (int i = n - 1; i >= 0; --i) {
        while (!st.empty() && a[st.top()] >= a[i]) {
            st.pop();
        }
        if (st.empty()) {
            right[i] = n;
        } else {
            right[i] = st.top();
        }
        st.push(i);
    }
    vector<int> pref(n + 1);
    for (int i = 1; i <= n; ++i) {
        pref[i] = pref[i - 1] + a[i - 1];
    }
    int ans = 0;
    for (auto i : b) {
        ans = max(ans, T / a[i]);
        int j = left[i];
        while (j >= 0) {
            int sum = pref[i + 1] - pref[j];
            if (sum > T) break;
            ans = max(ans, i - j + (T - sum) / a[j]);
            j = left[j];
        }
        j = right[i];
        while (j < n) {
            int sum = pref[j] - pref[i];
            if (sum > T) break;
            ans = max(ans, j - i + (T - sum) / a[j]);
            j = right[j];
        }
    }
    cout << ans;
}