#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int long long
#define ff first
#define ss second
#define endl '\n'
#define all(a) (a).begin, (a).end()

const int INF = 1e18 + 123;

void solve() {
    int n, m, t;
    cin >> n >> m >> t;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

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

    vector<int> pr(n + 1);
    for (int i = 0; i < n; ++i) {
        pr[i + 1] = pr[i] + a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int r = lower_bound(p.begin(), p.end(), i) - p.begin();
        int s = INF;
        if (r < m) {
            s = pr[p[r] + 1] - pr[i];
            if (t >= s) ans = max(ans, (t - s) / a[i] + p[r] - i + 1);
//            cout << ans << " " << i << " " << p[r] << " " << s << endl;
        }
        if (r - 1 >= 0) {
            s = pr[i + 1] - pr[p[r - 1]];
            if (t >= s) ans = max(ans, (t - s) / a[i] + i - p[r - 1] + 1);
//            cout << ans << " " << i << " " << p[r - 1] << " " << s << endl;
        }
    }

    cout << ans << endl;
}

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

    int qq = 1;
//    cin >> qq;
    while (qq--) {
        solve();
    }
}
