// #pragma GCC optimize("Ofast,fast-math,unroll-loops,no-stack-protector,inline")
#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    freopen("input.txt", "r", stdin);
    int n, m, t;
    cin >> n >> m >> t;
    vector<int> arr(n);
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    vector<int> arr1(m);
    for (int i = 0; i < m; i++) {
        cin >> arr1[i];
        arr1[i]--;
    }
    int ans = 0;
    for (int j = 0; j < m; j++) {
        int cur_t = 0;
        int ind = arr1[j];
        while (ind >= 0) {
            if (cur_t > t) {
                break;
            }
            ans = max(ans, arr1[j] - ind + (t - cur_t) / arr[ind]);
            cur_t += arr[ind];
            ind--;
        }
        cur_t = 0;
        ind = arr1[j];
        while (ind < n) {
            if (cur_t > t) {
                break;
            }
            ans = max(ans, ind - arr1[j] + (t - cur_t) / arr[ind]);
            cur_t += arr[ind];
            ind++;
        }
    }
    cout << ans << endl;
}