#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll M = 1e18 + 7;
struct sparse_table {
    ll K = 30;
    ll n;
    vector <vector <ll > > sp;
    void build(vector <ll > &a) {
        n = a.size();
        sp.resize(K, vector <ll > (n, M));
        sp[0] = a;
        for (ll k = 1; k < K; k++) {
            for (ll i = 0; i <= n - (1 << (k)); i++) {
                sp[k][i] = min(sp[k - 1][i], sp[k - 1][i + (1 << (k - 1))]);
            }
        }
//        for (auto x : sp) {
//            for (auto e : x) {
//                cout << e << ' ';
//            }
//            cout << endl;
//        }
    }
    ll get(ll l, ll r) { // [l, r)
        ll h = __lg(r - l);
        return min(sp[h][l], sp[h][r - (1 << (h))]);
    }
};
vector <ll > ps;
ll n, m, T;
sparse_table spt;
ll for_md(ll bi, ll md) { // [bi; bi + md]
    if (bi + md + 1 > n) return -M;
    ll sm = ps[bi + md + 1] - ps[bi];
    ll mn = spt.get(bi, bi + md + 1);
    ll h = T - sm;
    if (h < 0) {
        return -M;
    }
    ll ans = md + 1;
    ans += h / mn;
    return ans;
}
ll for_md_obr(ll bi, ll md) { // [bi - md, bi]
    if (bi - md < 0) return -M;
    ll sm = ps[bi + 1] - ps[bi - md];
    ll mn = spt.get(bi - md, bi + 1);
    ll h = T - sm;
    if (h < 0) {
        return -M;
    }
    ll ans = md + 1;
    ans += h / mn;
    return ans;
}
void solve() {
    cin >> n >> m >> T;
    vector <ll > a(n), b(m);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (ll i = 0; i < m; i++) {
        cin >> b[i];
        b[i]--;
    }

    ps.resize(n + 1);
    for (ll i = 1; i <= n; i++) {
        ps[i] = ps[i - 1] + a[i - 1];
    }
    spt.build(a);


    ll mx = 0;
    for (ll q1 = 0; q1 < m; q1++) {
        ll frgh = 0, frlf = 0;
        if (b[q1] < n - 1) {
            ll l = 0, r = n - b[q1] - 1;
            for (ll qq = 0; qq < 70; qq++) {
                ll l1 = l + (r - l) / 3;
                ll l2 = r - (r - l) / 3;
                ll a1 = for_md(b[q1], l1);
                ll a2 = for_md(b[q1], l2);
                if (a1 >= a2) {
                    r = l2;
                } else {
                    l = l1;
                }
            }
            frgh = max({for_md(b[q1], l), for_md(b[q1], l + 1), for_md(b[q1], r)});
//            cout << l << ' ' << r << endl;
        }

        if (b[q1] > 0) {
            ll l = 0, r = b[q1];
            for (ll qq = 0; qq < 70; qq++) {
                ll l1 = l + (r - l) / 3;
                ll l2 = r - (r - l) / 3;
                ll a1 = for_md_obr(b[q1], l1);
                ll a2 = for_md_obr(b[q1], l2);
                if (a1 >= a2) {
                    r = l2;
                } else {
                    l = l1;
                }
            }
//            cout << l << ' ' << r << endl;
            frlf = max({for_md_obr(b[q1], l), for_md_obr(b[q1], l + 1), for_md_obr(b[q1], r)});
        }
        mx = max({mx, frgh, frlf, for_md(b[q1], 0)});

//        cout << mx << endl;
    }
    cout << mx << endl;
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    ll z; cin >> z; while(z--)
    solve();
    return 0;
}

/*
5 3
3 7 10 1 2

 5 2
 5 4 3 2 1
*/