#include <bits/stdc++.h>


using namespace std;


using ll = long long;


const ll inf = 1e9 + 7;


template<typename T>
ostream & operator <<(ostream &os, const vector<T> &a) {
    for (T el : a) {
        os << el << " ";
    }
    os << '\n';
    return os;
}


ll func(const vector<ll> &a, int pos, ll T) {
    ll buf = T;
    ll cnt = 0;
    ll prev = 0;
    for (int i = pos; i >= 0; i--) {
        if (a.at(i) > buf) {
            break;
        }
        ll curr = buf / a.at(i);
        cnt = max(curr + prev, cnt);
        prev++;
        buf -= a.at(i);
    }
    prev = 0;
    buf = T;
    for (int i = pos; i < int(a.size()); i++) {
        if (a.at(i) > buf) {
            break;
        }
        ll curr = buf / a.at(i);
        cnt = max(curr + prev, cnt);
        prev++;
        buf -= a.at(i);
    }
    return cnt;
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    ll T;
    cin >> n >> m >> T;
    vector<ll> a(n + 1, 0);
    vector<int> b(m);
    for (int i = 1; i <= n; i++) {
        cin >> a.at(i);
    }
    ll ans = 0;
    for (int i = 0; i < m; i++) {
        cin >> b.at(i);
        ans = max(ans, T / a.at(b.at(i)));
    }
    vector<ll> pref(n + 1, 0);
    for (int i = 1; i < n + 1; i++) {
        pref.at(i) = pref.at(i - 1) + a.at(i);
    }
    for (int i = 0; i < m - 1; i++) {
        int p1 = b.at(i), p2 = b.at(i + 1);
        for (int j = p1 + 1; j < p2; j++) {
            ll d1 = j - p1;
            ll pr1 = pref.at(j - 1) - pref.at(p1 - 1);
            ll d2 = p2 - j;
            ll pr2 = pref.at(p2) - pref.at(j);
            if (pr1 <= T) {
                ans = max(ans, (T - pr1) / a.at(j) + d1);
            }
            if (pr2 <= T) {
                ans = max(ans, (T - pr2) / a.at(j) + d2);
            }
        }
    }
    for (int j = 1; j < b.at(0); j++) {
        ll d = b.at(0) - j;
        ll pr = pref.at(b.at(0)) - pref.at(j);
        if (pr <= T) {
            ans = max(ans, (T - pr) / a.at(j) + d);
        }
    }
    for (int j = b.at(m - 1) + 1; j <= n; j++) {
        ll pr = pref.at(j - 1) - pref.at(b.at(m - 1) - 1);
        ll d = j - b.at(m - 1);
        if (pr <= T) {
            ans = max(ans, (T - pr) / a.at(j) + d);
        }
    }
    cout << ans;
    return 0;
}
