#include "bits/stdc++.h"

using namespace std;

#define int long long

void solve() {
    int n, m, t;
    cin >> n >> m >> t;

    vector<int> a(n + 1), b(m + 2);
    b[m + 1] = n;

    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    for (int i = 1; i <= m; i++) {
        cin >> b[i];
    }

    int maxes = 0;

    for (int i = 1; i <= m; i++) {
        int time = 0, cnt = 0, j = b[i];
        while (time + a[j] <= t && j >= max(1ll, b[i - 1])) {
            int g = (t - time) / a[j];
            maxes = max(maxes, cnt + g);
            cnt++;
            time += a[j];
            j--;
        }

        time = 0, cnt = 0, j = b[i];

        while (time + a[j] <= t && j <= min(n, b[i + 1])) {
            int g = (t - time) / a[j];
            maxes = max(maxes, cnt + g);
            cnt++;

            time += a[j];
            j++;
        }
    }

    cout << maxes << '\n';
}
signed main() {
#ifdef local
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int akbalin = 1;
    // cin >> akbalin;

    for (int i = 1; i <= akbalin; i++) {
        solve();
    }
}