#include <bits/stdc++.h>

using ll = long long;
using namespace std;
const int INF = 1e9, MOD = 1e9 + 7;
#define all(a) a.begin(), a.end()
#define rall(a) a.begin(), a.end()
void solve() {
    int n, m;
    ll t;
    cin >> n >> m >> t;
    vector<ll> a(n), b(m);
    for (auto &i : a) cin >> i;
    for (auto &i : b) cin >> i;
    vector<ll> pref(n + 1, 0);
    for (int i = 1; i <= n; ++i) {
        pref[i] = pref[i - 1] + a[i - 1];
    }
    ll ans = 0;
    for (int i = 0; i < m; ++i) {
        for (int j = 1; j <= n; ++j) {
            ll cur;
            if (b[i] <= j) {
                cur = j - b[i] + max(0ll, t - (pref[j - 1] - pref[b[i] - 1])) / a[j - 1];
            } else {
                cur = b[i] - j + max(0ll, t - (pref[b[i]] - pref[j])) / a[j - 1];
            }
            ans = max(ans, cur);
        }
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}
