#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 1;
int a[maxn], b[maxn];

int n, m, T;

void solve() {
    cin >> n >> m >> T;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int j = 1; j <= m; j++) {
        cin >> b[j]; b[j]--;
    }
    b[0] = -1;
    b[m + 1] = n;
    int ans = 0;
    for (int j = 1; j <= m; j++) {
        int len = 0, cnt = 0;
        for (int i = b[j]; i < b[j + 1]; i++) {
            len += a[i];
            cnt++;
            if (len > T) break;
            ans = max(ans, cnt + (T - len) / a[i]);
        }
        len = cnt = 0;
        for (int i = b[j]; i > b[j - 1]; i--) {
            len += a[b[j]];
            cnt++;
            if (len > T) break;
            ans = max(ans, cnt + (T - len) / a[i]);
        }
    }
    cout << ans << '\n';
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tests = 1;
    while (tests--) solve();
    exit(526934911 & 0);
}
