#ifdef LOCAL
#define _GLIBCXX_DEBUG
#else
#pragma GCC optimize("O3")
#endif

#include <bits/stdc++.h>

using namespace std;

#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int((x).size())
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
using ll = int64_t;
using ull = uint64_t;
using ld = long double;

mt19937_64 rnd(52);

void solve() {
    int n, m;
    ll T;
    cin >> n >> m >> T;
    ll ans = 0;
    vector<int> a(n), b(m);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int j = 0; j < m; j++) {
        cin >> b[j];
        b[j]--;
    }
    b.push_back(-1);
    b.push_back(n);
    sort(all(b));
    for (int j = 1; j <= m; j++) {
        ll passed = 0;
        ll score = 0;
        for (int k = b[j]; k > b[j - 1]; k--) {
            if (passed <= T) {
                ans = max(ans, score + (T - passed) / a[k]);
            }
            score++;
            passed += a[k];
        }
        passed = 0;
        score = 0;
        for (int k = b[j]; k < b[j + 1]; k++) {
            if (passed <= T) {
                ans = max(ans, score + (T - passed) / a[k]);
            }
            score++;
            passed += a[k];
        }
    }
    cout << ans << '\n';
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    while (t--) solve();
}