//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2")
#define _GLIBCXX_DEBUG 1
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

#define forsn(i,s,e) for(ll i = s; i <= e; i++)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln '\n'
#define all(x) x.begin(), x.end()

const ll inf = INT64_MAX;

vector <ll> pref;

ll get_sum(ll l, ll r) {
    if (l > r)
        return 0;
    if (l == 0)
        return pref[r];
    return pref[r] - pref[l - 1];
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0);

    ll n, m, T;
    cin >> n >> m >> T;
    vector <ll> a(n);
    for (ll& i: a)
        cin >> i;
    vector <ll> b(m);
    for (ll& i: b)
        cin >> i;

    pref.resize(n);
    pref[0] = a[0];
    forsn(i, 1, n - 1) {
        pref[i] = pref[i - 1] + a[i];
    }

    ll ans = 0;
    forsn(j, 0, m - 1) {
        forsn(i, 0, n - 1) {
            ll t = get_sum(b[j] - 1, i - 1);
            ll cnt = i - b[j] + 1;
            if (b[j] - 1 > i) {
                t = get_sum(i + 1, b[j] - 1);
                cnt = b[j] - i - 1;
            }
            ll val = cnt + (T - t) / a[i];
            ans = max(ans, val);
        }
    }

    cout << ans;

    return 0;
}
