#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using li = __int128;
using db = double;
using ld = long double;
using pi = pair <int, int>;
using pll = pair <ll, ll>;
#define all(x) x.begin(), x.end()

const int INF = 1e9;

mt19937 rnd(time(NULL));

struct V {
    db x;
    db y;
};

V operator+ (const V& a, const V& b) {
    return {a.x + b.x, a.y + b.y};
}
db operator* (const V& a, const V& b) {
    return a.x * b.x + a.y * b.y;
}
db operator^ (const V& a, const V& b) {
    return a.x * b.y - a.y * b.x;
}
V operator* (const V& a, db k) {
    return {a.x * k, a.y * k};
}

ll bin_pow(ll a, ll s, ll mod) {
    ll res = 1;
    while (s) {
        if (s & 1) {
            res *= a;
            res %= mod;
        }
        a = (a * a) % mod;
        s >>= 1;
    }
    return res;
}


void solve() {
    int n, m;
    int T;
    cin >> n >> m >> T;
    vector <ll> a(n);
    vector <int> b(m);
    for (auto& i : a) cin >> i;
    for (auto& i : b) cin >> i, --i;

    vector <ll> pref(n + 1);
    for (int i = 0; i < n; ++i) {
        pref[i + 1] = pref[i] + a[i];
    }

    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        auto itl = upper_bound(all(b), i) - 1;
        auto itr = lower_bound(all(b), i);
        int l;
        int r;
        if (b.begin() <= itl && itl < b.end()) l = *itl;
        else l = INF;
        if (b.begin() <= itr && itr < b.end()) r = *itr;
        else r = -INF;

        ll tl = 0;
        if (0 <= l && l < n) tl = pref[i] - pref[l];
        ll tr = 0;
        if (0 <= r && r < n) tr = pref[r + 1] - pref[i + 1];
        if (tl <= T) ans = max(ans, i - l + (T - tl) / a[i]);
        if (tr <= T) ans = max(ans, r - i + (T - tr) / a[i]);
    }

    cout << ans << '\n';
}


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) solve();
    return 0;
}
