    #include <bits/stdc++.h>
    #define int long long
    using namespace std;

    const int INF = 2e16;

    signed main() {
        int n, m, t;
        cin >> n >> m >> t;
        vector<int> arr(n), a(m), pref(n + 1), ans(m);
        vector<pair<int,int>> all;
        for (int i = 0; i < n; i++) {
            cin >> arr[i];
            pref[i + 1] = pref[i] + arr[i];
        }
        for (int i = 0; i < m; i++) {
            cin >> a[i];
            a[i]--;
        }
        sort(a.begin(), a.end());
        int l = 0;
        for (int i = 0; i < n; i++) {
            while (l != m - 1) {
                if (a[l + 1] <= i) {
                    l++;
                } else {
                    break;
                }
            }
            int ind = a[l];
            int sm = pref[i] - pref[ind];
            if (sm <= t) {
                ans[l] = max(ans[l], (t - sm) / arr[i] + i - ind);
                // cout << l << ' ' << ans[l] << "\n";
            }
            if (l != m - 1) {
                int ind2 = a[l + 1];
                sm = pref[ind2 + 1] - pref[i + 1];
                if (sm <= t) {
                    ans[l + 1] = max(ans[l + 1], (t - sm) / arr[i] + ind2 - i);
                    // cout << l + 1 << " " << ans[l + 1] << "\n";
                }
            }
        }
        int mx1 = 0;
        for (int i = 0; i < m; i++) {
            mx1 = max(mx1, ans[i]);
        }
        cout << mx1;
    }