#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <deque>

using namespace std;

typedef long long ll;
typedef long double ld;

const ll inf = 1e18;
const ll mod = 1e9 + 7;

ll t;
vector<ll> a;
vector<ll> pref;

ll res(ll i, ll j) {
    ll sum1 = pref[j];
    if (i != 0) sum1 -= pref[i - 1];
    ll ans1 = (t - sum1) / a[j] + (j - i + 1);
    if (t - sum1 < 0) ans1 = -inf;
    return ans1;
}

void solve() {
    ll n, m; cin >> n >> m >> t;
    a.assign(n, 0);
    for(int i = 0; i < n; i++) cin >> a[i];
    vector<ll> b(m);
    vector<ll> ok(n);
    for(int i = 0; i < m; i++) {
        cin >> b[i];
        b[i]--;
        ok[b[i]] = 1;
    }
    pref.assign(n, 0);
    for(int i = 0; i < n; i++) {
        pref[i] = a[i];
        if (i != 0) pref[i] += pref[i - 1];
    }
    ll ans = 0;
    for(int iter = 0; iter < 2; iter++) {
        deque<pair<ll, ll>> q;
        for (int i = n - 1; i >= 0; i--) {
            while (!q.empty()) {
                if (q.back().first > a[i]) {
                    q.pop_back();
                } else {
                    break;
                }
            }
            q.push_back({a[i], i});
            if (ok[i]) {
                ll l = 0, r = ll(q.size()) - 1;
                while (r - l > 1500) {
                    ll m1 = l + (r - l) / 3;
                    ll m2 = r - (r - l) / 3;
                    ll ans1 = res(i, q[m1].second), ans2 = res(i, q[m2].second);
                    ans = max(ans, ans1);
                    ans = max(ans, ans2);
                    if (ans1 < ans2) {
                        l = m1;
                    } else {
                        r = m2;
                    }
                }
                for (int j = l; j <= r; j++) {
                    ans = max(ans, res(i, q[j].second));
                }
                for (int j = 0; j <= min(ll(q.size()) - 1, 100LL); j++) {
                    ans = max(ans, res(i, q[j].second));
                }
                for (int j = max(0LL, ll(q.size()) - 100); j < ll(q.size()); j++) {
                    ans = max(ans, res(i, q[j].second));
                }
            }
        }
        q.clear();
        reverse(a.begin(), a.end());
        fill(ok.begin(), ok.end(), 0);
        for (int i = 0; i < m; i++) {
            b[i] = n - b[i] - 1;
            ok[b[i]] = 1;
        }
        pref.assign(n, 0);
        for(int i = 0; i < n; i++) {
            pref[i] = a[i];
            if (i != 0) pref[i] += pref[i - 1];
        }
    }
    cout << ans << "\n";
}

int main() {
#ifdef KABANDJAN
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll ttt = 1;
//    cin >> ttt;
    while(ttt--) {
        solve();
    }
    return 0;
}
