#include <bits/stdc++.h>
// #pragma GCC optimize("O3")
// #pragma GCC target("avx2")
#define LOCAL

#define int long long

// std::mt19937 rnd(time(0));

void solve();

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    #ifdef LOCAL
        std::freopen("input.txt", "r", stdin);
        std::freopen("output.txt", "w", stdout);
    #endif

    int t = 1;
    // std::cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}

void solve() {
    int n, m, T;
    std::cin >> n >> m >> T;

    std::vector <int> lens(n);
    std::set <int> starts;

    for (int i = 0; i < n; ++i) {
        std::cin >> lens[i];
    }
    for (int i = 0; i < m; ++i) {
        int x;
        std::cin >> x;

        --x;

        starts.insert(x);
    }

    std::vector <long long> prefSum(n, lens[0]);
    for (int i = 1; i < n; ++i) {
        prefSum[i] = prefSum[i - 1] + lens[i];
    }

    int res = 0;
    for (int i = 0; i < n; ++i) {
        auto r = starts.lower_bound(i);
        if (r != starts.end() && *r < n && i <= *r) {
            int curRes = (T - (prefSum[*r] - prefSum[i])) / lens[i] + *r - i;
            if (prefSum[*r] - prefSum[i] + lens[i] <= T) res = std::max(curRes, res);
        }


        auto l = r;
        if (l != starts.begin()) {
            --l;
        }
        if (l != starts.end() && 0 < i && *l < i) {
            int curRes = (T - (prefSum[i - 1] - prefSum[*l] + lens[*l])) / lens[i] + i - *l;
            if ((prefSum[i] - prefSum[*l] + lens[*l]) <= T) res = std::max(curRes, res);
        }
    }
// gehhe
    std::cout << res;
}