#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <climits>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<ll, ll>;

#define all(v) v.begin(), v.end()
#define len(v) (ll)v.size()

mt19937 rnd(525252);

const ll INF = 1e9, SZ = 30, MOD = 1e9 + 7;
const ld eps = 1e-8, pi = acosl(-1);

void f(vector<ll>&dp, vector<ll>&pref, vector<ll>&v, ll t, ll l, ll r, ll optl, ll optr){
//    if (optl > optr) throw(0);
    if (l > r) return;
    ll m = (l + r) / 2;
    pii best = {t / v[m], m};
    for (ll i = optl; i <= optr; ++i){

        ll time = 0;
        if (m < i) time = pref[i - 1] - (m == 0 ? 0 : pref[m - 1]);
        if (m > i) time = pref[m] - pref[i];

        if (time > t) continue;
        ll cur = abs(i - m) + (t - time) / v[i];

        best = max(best, {cur, i});
    }
    dp[m] = best.first;
    f(dp, pref, v, t, l, m - 1, optl, max(optr, best.second));
    f(dp, pref, v, t, m + 1, r, min(optl, best.second), optr);
}

void solve() {
    ll n, m, t; cin >> n >> m >> t;
    vector<ll>a(n), b(m);
    for (auto &i : a) {
        cin >> i;
    }
    for (auto &i : b){
        cin >> i;
        i--;
    }
    vector<ll>pref(n);
    pref[0] = a[0];
    for (ll i = 1; i < n; ++i) pref[i] = pref[i - 1] + a[i];
    vector<ll>dp(n);
    f(dp, pref, a, t, 0, n - 1, 0, n - 1);
    ll best = 0;
    for (auto & i : b) best = max(best, dp[i]);
    cout << best;
}

int main()
{
    ll t = 1;
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
//    cin >> t;

    while (t--) {
        solve();
        cout << '\n';
    }
}
