#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

#define int ll
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using ordered_set = __gnu_pbds::tree<int, __gnu_pbds::null_type, less<int>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

mt19937 rnd(time(0));

inline void solve() {
    int n, m, T;
    cin >> n >> m >> T;
    vector<int> a(n);
    for (auto &x: a) cin >> x;
    vector<int> pref(n + 1);
    for (int i = 0; i < n; i++) pref[i + 1] = pref[i] + a[i];
    vector<int> b(m);
    for (auto &x: b) {
        cin >> x;
        x--;
    }
    int l = -1, r = 1e10;
    while (r - l > 1) {
        int m1 = (r + l) / 2;
        if (m1 == 4) {
            int k2fuh = 0;
        }
        for (int i = 0; i < n; i++) {
            int l1 = -1, r1 = i + 1;
            while (r1 - l1 > 1) {
                int m2 = (r1 + l1) / 2;
                int cnt = m1 - (i - m2);
                int s = pref[i] - pref[m2];
                if (s + cnt * a[i] <= T) {
                    r1 = m2;
                } else {
                    l1 = m2;
                }
            }
            int L = r1;
            l1 = i - 1;
            r1 = n;
            while (r1 - l1 > 1) {
                int m2 = (r1 + l1) / 2;
                int cnt = m1 - (m2 - i);
                int s = pref[m2 + 1] - pref[i + 1];
                if (s + cnt * a[i] <= T) {
                    l1 = m2;
                } else {
                    r1 = m2;
                }
            }
            int R = l1;
            if (upper_bound(all(b), R) - lower_bound(all(b), L) > 0) {
                l = m1;
                break;
            }
        }
        if (l != m1) r = m1;
    }
    cout << l;
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) solve();
}