#include <bits/stdc++.h>

using namespace std;
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef long long ll;

void solve();

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

    int tt = 1; //cin >> tt;
    while (tt--) {
        solve();
        cout << "\n";
    }
}

void solve() {
    int n, m, T; cin >> n >> m >> T;
    vector<ll> a(n + 1), pref(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        pref[i] = pref[i - 1] + a[i];
    }

    vector<int> b(m);
    for (int i = 0; i < m; i++) cin >> b[i];
    sort(all(b));

    if (n == m) {
        ll mn = a[0];
        for (int i = 0; i < n; i++) mn = min(mn, a[i]);
        cout << T / mn;
        return;
    }

    ll mx = 0, l = 1, r = 1;
    for (int i = 0; i < m; i++) {
        while (r + 1 <= b[i]) {
            r++;
            while (pref[r] - pref[l - 1] > T) l++;
        }

        if (pref[r] - pref[l - 1] <= T) {
            ll ans = r - l + 1;
            ans += (T - (pref[r] - pref[l - 1])) / a[l];
            mx = max(mx, ans);
        }
    }

    cout << mx;
}
