#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m, T; cin >> n >> m >> T;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; ++i) cin >> a[i];
    vector<int> b(m + 1);
    for (int i = 1; i <= m; ++i) cin >> b[i];
    vector<int> ans(m + 1);
    for (int i = 1; i <= m; ++i) {
        int rem = T;
        for (int j = b[i]; j <= n; ++j) {
            rem -= a[j];
            if (rem < 0) break;
            ans[i] = max(ans[i], (j - b[i] + 1) + rem / a[j]);
        }
        rem = T;
        for (int j = b[i]; j >= 1; --j) {
            rem -= a[j];
            if (rem < 0) break;
            ans[i] = max(ans[i], (b[i] - j + 1) + rem / a[j]);
        }
    }
    int res = 0;
    for (auto i : ans) res = max(res, i);
    cout << res;
    return 0;
}
