#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
using ll = long long;

template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int maxn = 3e5;
int t[4 * maxn];
int a[maxn + 5];

void build(int v, int l, int r) {
    if (r - l == 1) {
        t[v] = l;
        return;
    }

    int m = (l + r) / 2;
    build(2 * v, l, m);
    build(2 * v + 1, m, r);

    if (a[t[2 * v]] < a[t[2 * v + 1]]) {
        t[v] = t[2 * v];
    } else {
        t[v] = t[2 * v + 1];
    }
}

int get(int v, int l, int r, int ql, int qr) {
    if (qr <= l || r <= ql) {
        return maxn;
    }

    if (ql <= l && r <= qr) {
        return t[v];
    }
    int m = (l + r) / 2;
    int get1 = get(2 * v, l, m, ql, qr);
    int get2 = get(2 * v + 1, m, r, ql, qr);

    if (get1 == maxn) {
        return get2;
    } else if (get2 == maxn) {
        return get1;
    }

    if (a[get1] < a[get2]) {
        return get1;
    } else {
        return get2;
    }
}

signed main() {
    //ios::sync_with_stdio(0);
    //cin.tie(0);

    int n, m, t;
    cin >> n >> m >> t;

    vector <int> b(m);
    vector <ll> pref(n+1);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        pref[i+1] = a[i] + pref[i];
    }

    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }

    build(1, 0, n);

    //cout << get(1, 0, n, 1, 4);

    vector <int> ans(n);

    int lastmn = -1;
    for (int i = 0; i < n; i++) {
        if (lastmn == -1) {
            ans[i] = max(ans[i], t / a[i]);
            lastmn = i;
        } else {
            int cur1 = t / a[i];
            int cur2 = -1e9;

            while (pref[i+1] - pref[lastmn+1] > t) {
                //cout << lastmn << ' ' << i << '\n';
                lastmn = get(1, 0, n, lastmn + 1, i + 1);
                //cout << lastmn << ' ';
            }

            //cout << "+ " << lastmn << '\n';

            cur2 = (t - pref[i+1] + pref[lastmn+1]) / a[lastmn] + (i - lastmn);

            ans[i] = max(ans[i], max(cur1, cur2));
        }
    }

    lastmn = -1;

    for (int i = n-1; i >= 0; i--) {
        if (lastmn == -1) {
            ans[i] = max(ans[i], t / a[i]);
            lastmn = i;
        } else {
            int cur1 = t / a[i];
            int cur2 = -1e9;

            while (pref[lastmn] - pref[i] > t) {
                lastmn = get(1, 0, n, i, lastmn);
            }
            cur2 = (t - pref[lastmn] + pref[i]) / a[lastmn] + (lastmn - i);

            //if (cur1 >= cur2) {
            //    lastmn = i;
            //}

            ans[i] = max(ans[i], max(cur1, cur2));
        }
    }
    

    int res = 0;

    for (int i = 0; i < m; i++) {
        res = max(res, ans[b[i]-1]);
    }

    cout << res << '\n';
}
