#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 int INF = 1e9;

mt19937 rnd(42);


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

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

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

        int 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]);
    }

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

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

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

    int find(int i, int l, int r, int x) {
        if (l + 1 == r) return l;
        int 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(int i, int l, int r, vector<int>& v) {
        if (l + 1 == r) {
            t[i] = v[l];
            return;
        }

        int 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<int> v) {
        n = v.size();
        t.assign(n * 4 + 10, 0);
        build(0, 0, n, v);
    }

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

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

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

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

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

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

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

                int 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]);

        int j = st.find(t - px[i + 1]);
        assert(t - px[i + 1] >= t + 1 - px[1]);
        if (j > i || j < 0) 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 (int i = 0; i < n; ++i) {
        px[i + 1] = a[i] + px[i];
    }


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

                int 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]);

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

    int mx = 0;

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

    cout << mx << endl;
} 

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