#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll M = 1e9 + 7;
struct node {
    ll sm = 0, mn = M;
};
node neutral = {0, M};
struct segment_tree {
    ll sz;
    vector <node > t;
    ll lv(ll v) {
        return v * 2 + 1;
    }
    ll rv(ll v) {
        return v * 2 + 2;
    }
    node f(node a, node b) {
        return {a.sm + b.sm, min(a.mn, b.mn)};
    }
    void upd_v(ll v) {
        t[v] = f(t[lv(v)], t[rv(v)]);
    }
    void build(vector <ll > &a) {
        sz = a.size() * 4;
        t.resize(sz, neutral);
        build(0, 0, sz / 4, a);
    }
    void build(ll v, ll l, ll r, vector <ll > &a) {
        if (l + 1 == r) {
            t[v].mn = a[l];
            t[v].sm = a[l];
            return;
        }
        ll md = (r + l) >> 1;
        build(lv(v), l, md, a);
        build(rv(v), md, r, a);
        upd_v(v);
    }

    node get(ll l, ll r) {
        return get(0, 0, sz / 4, l, r);
    }
    node get(ll v, ll l, ll r, ll ql, ll qr) {
        if (l >= qr || r <= ql) {
            return neutral;
        }
        if (ql <= l && r <= qr) {
            return t[v];
        }
        ll md = (r + l) >> 1;
        return f(get(lv(v), l, md, ql, qr),\
                 get(rv(v), md, r, ql ,qr));
    }
};

struct sparse_table {
    ll K = 25;
    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 - 1)); i++) {
                sp[k][i] = min(sp[k - 1][i], sp[k - 1][i + (1 << (k - 1))]);
            }
        }
    }
    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;
//segment_tree sgt;
sparse_table spt;
ll for_md(ll bi, ll md) { // [bi; bi + md]
    ll sm = ps[bi + md + 1] - ps[bi];
    ll mn = spt.get(bi, bi + md + 1);
    ll h = T - sm;
    if (h < 0) {
        return 0;
    }
    ll ans = md + 1;
    ans += h / mn;
    return ans;
}
ll for_md_obr(ll bi, ll md) { // [bi - md, bi]
    ll sm = ps[bi + 1] - ps[bi - md];
    ll mn = spt.get(bi - md, bi + 1);
    ll h = T - sm;
    if (h < 0) {
        return 0;
    }
    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);


//    sgt.build(a);
    ll mx = 0;
    for (ll q1 = 0; q1 < m; q1++) {
        ll frgh = 0;
        if (b[q1] != n - 1) {
            ll l = 0, r = n - b[q1] - 1;
            for (ll qq = 0; qq < 50; 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;
        }
        ll frlf = 0;
        if (b[q1] != 0) {
            ll l = 0, r = b[q1];
            for (ll qq = 0; qq < 50; 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});

//        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
*/