#include <bits/stdc++.h>

using ll = long long;

using namespace std;

void solve() {
    ll n, m, T;
    cin >> n >> m >> T;
    vector<ll> A(n), B(m);
    for (ll i = 0; i < n; i++) {
        cin >> A[i];
    }
    for (ll i = 0; i < m; i++) {
        cin >> B[i];
    }
    ll mx = 0;
    for (ll i = 0; i < m; i++) {
        ll sum = 0;
        for (ll j = B[i] - 1; j < n && sum <= T; j++) {
            if (A[j] < A[B[i] - 1]) {
                mx = max(mx, (T - sum) / A[j] + abs(j - (B[i] - 1)));
            }
            sum += A[j];
        }
        sum = 0;
        for (ll j = B[i] - 1; j >= 0 && sum <= T; j--) {
            if (A[j] < A[B[i] - 1]) {
                mx = max(mx, (T - sum) / A[j] + abs(j - (B[i] - 1)));
            }
            sum += A[j];
        }
    }
    cout << mx << '\n';
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t = 1;
    //cin >> t;
    for (ll i = 0; i < t; i++) {
        solve();
    }
    return 0;
}
