#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <numeric>

#define all(a) a.begin(), a.end()
#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

constexpr ll inf = 1e18;

void solve() {
    int n, m, t;
    cin >> n >> m >> t;
    vector<int> a(n);
    vector<int> b(m);
    for (int &e : a) cin >> e;
    for (int &e : b) {
        cin >> e;
        e--;
    }
    ll ans = 0;
    for (int const &e : b) {
        ll s = 0;
        for (int i = e; i >= 0; --i) {
            ans = max(ans, e - i + (t - s) / a[i]);
            s += a[i];
            if (s > t) break;
        }
        s = 0;
        for (int i = e; i < n; ++i) {
            ans = max(ans, i - e + (t - s) / a[i]);
            s += a[i];
            if (s > t) break;
        }
    }
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
}