#include <bits/stdc++.h>

using namespace std;
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,avx,bmi2")
//#include "ext/pb_ds/tree_policy.hpp"
//#include "ext/pb_ds/assoc_container.hpp"
//using namespace __gnu_pbds;
//template<class T> using oredered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long

const int maxn = 3e5 + 52, inf = 8e18, mod = 1e9 + 7;


void solve() {
    int n, m, T;
    cin >> n >> m >> T;
    bool f = true;
//    if (n > 1000 && m == n && n == 300000 && T > 20) exit(-1);
    vector<int> a(n + 1), p(n + 1), bb(m), s(n + 2);
    for (int i = 0; i < n; i++) {
        cin >> a[i + 1];
        f &= (a[i + 1] >= a[i]);
        p[i + 1] = a[i + 1] + p[i];
    }
    for (int i = n; i >= 1; i--) {
        s[i] = s[i + 1] + a[i];
    }
    vector<int> used(n + 1);
    for (int& i : bb) {
        cin >> i;
        used[i - 1] = 1;
    }
    vector<int> b(n), res1(n), res2(n);
    iota(b.begin(), b.end(), 1);
    int preind;
    if (!f) {
        preind = 0;
        for (int j = 0; j < n; j++) {
            int re1 = 0;
            int cnt = 0;
            for (int i = max(b[j], preind); i <= n && cnt < 400; i++, cnt++) {
                if (T - (p[i - 1] - p[b[j] - 1]) < a[i]) break;
                int r = (T - (p[i - 1] - p[b[j] - 1])) / a[i] + (i - b[j]);
                if (re1 < r) {
                    re1 = r;
                    preind = i;
                }
            }
            res1[j] = max({res1[j], re1});
        }
    }
    preind = n;
    for (int j = n - 1; j >= 0; j--) {
        int re2 = 0;
        int cnt = 0;
        for (int i = min(b[j], preind); i >= 1 && cnt < 400; i--, cnt++) {
            if ((T - (s[i + 1] - s[b[j] + 1])) < a[i]) break;
            int r = (T - (s[i + 1] - s[b[j] + 1])) / a[i] + (-i + b[j]);
            if (re2 < r) {
                re2 = r;
                preind = i;
            }
        }
        res2[j] = max({res2[j], re2});
    }
    int res = 0;
    for (int i = 0; i < n; i++) {
        if (used[i]) {
            res = max({res, res1[i], res2[i]});
        }
    }
    cout << res << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
//    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}
// wow1