#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const ll N = 3e5 + 5;

ll a[N];
vector<ll> b;
ll p[N];
void solve() {
    ll n, m, t;
    cin >> n >> m >> t;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        p[i] = p[i - 1] + a[i];
    }
    for (int i = 0; i < m; ++i) {
        ll u;
        cin >> u;
        b.push_back(u);
    }
    ll ans = 0;
    ll rk = 0;
    for (int i = 1; i <= n; ++i) {
        while (rk < m && b[rk] <= i) {
            rk++;
        }
        ll lk = rk - 1;
        if (lk != -1 && lk != m) {
           if (p[i - 1] - p[b[lk] - 1] <= t) ans = max(ans, abs(i - b[lk]) + (t - (p[i - 1] - p[b[lk] - 1])) / a[i]);
        }
        if (rk != -1 && rk != m) {
           if ((p[b[rk]] - p[i]) <= t) ans = max(ans, abs(i - b[rk]) + (t - (p[b[rk]] - p[i])) / a[i]);
        }
    }
    cout << ans;
}

int main() {
    int test = 1;
    // cin >> test;
    while (test--) {
        solve();
    }
}
