// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define int long long
// #define ll __int128
using namespace std;
// using namespace __gnu_pbds;
// #define unordered_map gp_hash_table
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

const int INF = 1e13 + 7;

void solve() {
    int n, m, t;
    cin >> n >> m >> t;
    vector<int> a(n);
    for (int &i : a) {
        cin >> i;
    }
    vector<int> b(m);
    for(int &i : b) {
        cin >> i;
        i--;
    }
    b.insert(b.begin(), -INF);
    b.push_back(INF);
    vector<int> pref(n + 1);
    for (int i = 0; i < n; i++) {
        pref[i + 1] = pref[i] + a[i];
    }
    auto get_sum = [&](int l, int r) -> int {
        return pref[r + 1] - pref[l];
    };
    int max_res = 0;
    for (int i = 0; i < n; i++) {
        auto it = upper_bound(b.begin(), b.end(), i);
        int l = *(it - 1);
        int r = *it;
        int left_res = -INF;
        int right_res = -INF;
        if (l != -INF) {
            int z = get_sum(l, i);
            if (z <= t) {
                left_res = i - l + 1 + (t - z) / a[i];
            }
        }
        if (r != INF) {
            int z = get_sum(i, r);
            if (z <= t) {
                left_res = r - i + 1 + (t - z) / a[i];
            }
        }
        max_res = max(max_res, max(left_res, right_res));
    }
    cout << max_res << "\n";
}

signed main() {
    // cout << fixed << setprecision(20);
    #ifdef LOCAL
    freopen("C:\\work\\input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    #endif
    solve();
}