#pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
#pragma GCC target("avx,avx2,bmi,bmi2")

using namespace std;

#define all(x) (x).begin(),x.end()

#ifdef DBG
#define debug(x) cout << #x << " = " << x << endl
#else
#define debug(x) 
#endif

using ll = long long;
using dbl = long double;

const ll INF = 1e18;

mt19937 rnd(42);


struct SegTree {
    ll n;
    vector<ll> t;

    ll merge(ll a, ll b) {
        return max(a, b);
    }

    void set(ll i, ll l, ll r, ll q, ll x) {
        if (q < l || r <= q) {
            return;
        }
        if (l + 1 == r) {
            t[i] = x;
            return;
        }

        ll mid = (l + r) / 2;
        set(i * 2 + 1, l, mid, q, x);
        set(i * 2 + 2, mid, r, q, x);

        t[i] = merge(t[i * 2 + 1], t[i * 2 + 2]);
    }

    ll get(ll i, ll l, ll r, ll ql, ll qr) {
        if (qr <= l || r <= ql) return -INF;

        if (ql <= l && r <= qr) return t[i];

        ll mid = (l + r) / 2;
        return merge(get(i * 2 + 1, l, mid, ql, qr), get(i * 2 + 2, mid, r, ql, qr));
    }

    ll find(ll i, ll l, ll r, ll x) {
        if (l + 1 == r) return l;
        ll mid = (l + r) / 2;
        if (t[i * 2 + 2] > x) {
            return find(i * 2 + 2, mid, r, x);
        } else {
            return find(i * 2 + 1, l, mid, x);
        }
    }
    
    void build(ll i, ll l, ll r, vector<ll>& v) {
        if (l + 1 == r) {
            t[i] = v[l];
            return;
        }

        ll mid = (l + r) / 2;
        build(i * 2 + 1, l, mid, v);
        build(i * 2 + 2, mid, r, v);

        t[i] = merge(t[i * 2 + 1], t[i * 2 + 2]);
    }
    
    SegTree (vector<ll> v) {
        n = v.size();
        t.assign(n * 4 + 10, 0);
        build(0, 0, n, v);
    }

    void set(ll i, ll x) {
        set(0, 0, n, i, x);
    }

    ll get(ll l, ll r) {
        return get(0, 0, n, l, r);
    }

    ll find(ll x) {
        if (get(0, n) <= x) return -1;
        return find(0, 0, n, x);
    }
};

inline void solve() {
    ll n, m, t;
    cin >> n >> m >> t;
    vector<ll> a(n), ans(n);
    vector<ll> px(n + 1, 0);

    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
        px[i + 1] = a[i] + px[i];
        ans[i] = t / a[i];
    }

    SegTree st(vector<ll>(n, -INF));

    for (ll i = 0; i < n; ++i) {
        ll L = 0;
        ll R = t + 1;
        if (i > 0) {
            while (L + 1 < R) {
                ll mid = (L + R) / 2;

                ll j = st.find(mid - px[i + 1]);
                if (j >= i) {
                    L = mid;
                    continue;
                }
                if (j < 0) {
                    R = mid;
                    continue;
                }
                if ((i - j) + (mid - (px[i + 1] - px[j + 1])) / a[j] >= mid / a[i]) {
                    R = mid;
                } else {
                    L = mid;
                }
            }
            if (a[i - 1] < a[i]) R = min(R, a[i]);
        }
        debug(i << " " << R);
        
        st.set(i, R - px[i + 1]);

        ll j = st.find(t - px[i + 1]);
        if (j > i) continue;
        debug(j);
        ans[i] = max(ans[i], (i - j) + (t - (px[i + 1] - px[j + 1])) / a[j]);
    }

    reverse(all(a));

    px[0] = 0;
    for (ll i = 0; i < n; ++i) {
        px[i + 1] = a[i] + px[i];
    }


    st = SegTree(vector<ll>(n, -INF));
    for (ll i = 0; i < n; ++i) {
        ll L = 0;
        ll R = t + 1;
        if (i > 0) {
            while (L + 1 < R) {
                ll mid = (L + R) / 2;

                ll j = st.find(mid - px[i + 1]);
                if (j >= i) {
                    L = mid;
                    continue;
                }

                if (j < 0) {
                    R = mid;
                    continue;
                }
                if ((i - j) + (mid - (px[i + 1] - px[j + 1])) / a[j] >= mid / a[i]) {
                    R = mid;
                } else {
                    L = mid;
                }
            }
            if (a[i - 1] < a[i]) R = min(R, a[i]);
        }
        debug(i << " " << R);
        
        st.set(i, R - px[i + 1]);

        ll j = st.find(t - px[i + 1]);
        if (j > i) continue;
        debug(j);
        ans[n - i - 1] = max(ans[n - i - 1], (i - j) + (t - (px[i + 1] - px[j + 1])) / a[j]);
    }

    ll mx = 0;

    for (ll i = 0; i < m; ++i) {
        ll b;
        cin >> b;
        b--;
        mx = max(ans[b], mx);
        debug(b << " " << ans[b]);
    }

    cout << mx << endl;
} 

int main() {
    ll t = 1;
    #ifdef DBG
    cin >> t;
    #endif
    for (ll i = 0; i < t; ++i) {
        solve();
        #ifdef DBG
        cout << '\n';
        #endif
    }
}