#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//using ll = int;
using ld = long double;
using ull = unsigned long long;
#define pb push_back
#define all(vec) vec.begin(), vec.end()
#define eb emplace_back
#ifdef LOCAL
#define deb(x) cout << #x << " = " << x << '\n'
#else
#define deb(x) 52
#endif
const ll inf = 1e9 + 11;
const long long INF = (long long)2e18 + 11;
const ll P = 73;
const ll MOD = 1e9 + 7;


void solve() {
    ll n, m, t;
    cin >> n >> m >> t;
    vector<ll> a(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<ll> b(m);
    for (ll i = 0; i < m; ++i) {
        cin >> b[i];
        --b[i];
    }
    vector<ll> pref(n + 1);
    for (ll i = 1; i <= n; ++i) {
        pref[i] = pref[i - 1] + a[i - 1];
    }
    auto get = [&](ll i, ll j) -> ll {
        if (pref[max(i, j) + 1] - pref[min(i, j)] > t) {
            return -(n - j - 1);
        }
        return abs(i - j) + 1 + (t - (pref[max(i, j) + 1] - pref[min(i, j)])) / a[j];
    };
    vector<ll> ans(n);
    ll cur_it = 0;
    vector<ll> stk;
    for (ll i = 0; i < n; ++i) {
        while (!stk.empty() && a[stk.back()] >= a[i]) {
            stk.pop_back();
        }
        cur_it = min(cur_it, (ll)stk.size() - 1);
        stk.pb(i);
        if (cur_it == -1) {
            ++cur_it;
        }
        while (cur_it + 1 < (ll)stk.size() && get(i, stk[cur_it]) < get(i, stk[cur_it + 1])) {
            ++cur_it;
        }
        ans[i] = max(ans[i], get(i, stk[cur_it]));
    }
    stk.clear();
    cur_it = 0;
    reverse(all(a));
    for (ll i = 1; i <= n; ++i) {
        pref[i] = pref[i - 1] + a[i - 1];
    }
    for (ll i = 0; i < n; ++i) {
        while (!stk.empty() && a[stk.back()] >= a[i]) {
            stk.pop_back();
        }
        cur_it = min(cur_it, (ll)stk.size() - 1);
        stk.pb(i);
        if (cur_it == -1) {
            ++cur_it;
        }
        while (cur_it + 1 < (ll)stk.size() && get(i, stk[cur_it]) < get(i, stk[cur_it + 1])) {
            ++cur_it;
        }
        ans[n - i - 1] = max(ans[n - i - 1], get(i, stk[cur_it]));
    }
    ll res = 0;
    for (ll i = 0; i < m; ++i) {
        res = max(res, ans[b[i]]);
    }
    cout << res;
}


int main() {
#ifdef LOCAL
    freopen("C:/work/untitled/input.txt", "r", stdin);
    freopen("C:/work/untitled/output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll cfmode = 0;
    ll tc = 1;
    if (cfmode) {
        cin >> tc;
    }
    while (tc--) {
        solve();
        if (tc) {
            cout << '\n';
        }
    }
}