#include "bits/stdc++.h"

using namespace std;
#define ll long long
#define ff first
#define ss second
mt19937 rnd(time(0));
#define int long long

const int maxn = 3e5 + 5;
int a[maxn], b[maxn];
int n, m, t;

int get(int st) {
    int t1 = t, t2;
    int cnt = 0, ans = 0;
    if (t1 < a[st])return 0;
    if (t1 >= a[st])t1 -= a[st], cnt++;
    if (t1 == 0)return cnt;
    t2 = t1;
    ans = cnt + t1 / a[st];
//    cout << t1 << '\n';
    int l = st - 1;
    while (l >= 0 && a[l] <= t1) {
        ans = max(ans, cnt + t1 / a[l]);
        cnt++;
        t1 -= a[l];
        l--;
    }
    t1 = t2;
    int r = st + 1;
    cnt = 1;
//    cout << t1 << ' ' << r;
    while (r < n && a[r] <= t1) {
        ans = max(ans, cnt + t1 / a[r]);
        cnt++;
        t1 -= a[r];
        r++;
    }
    return ans;
}

void solve() {
    cin >> n >> m >> t;
    for (int i = 0; i < n; i++)cin >> a[i];
    for (int i = 0; i < m; i++)cin >> b[i];
    int ans = 0;
    for (int i = 0; i < m; i++) {
        ans = max(ans, get(b[i] - 1));
//        cout << ans << '\n';
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cout.tie(nullptr);
    cin.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    solve();

}