#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
using namespace std;
using ll = long long;
using ull = unsigned long long;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//
//template <class T> using ordered_set = tree<T, null_type, less<T>,
//        rb_tree_tag, tree_order_statistics_node_update>;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

mt19937 rnd(time(0));



int main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0); std::cout.tie(0);
    int n, m, t;
    cin >> n >> m >> t;
    vector <ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector <ll> pref(n);
    pref[0] = a[0];
    for (int i = 1; i < n; i++) {
        pref[i] = pref[i - 1] + a[i];
    }
    vector <int> b(m);
    for (int i = 0; i < m; i++) {
        cin >> b[i]; b[i]--;
    }
    ll ans = 0;
    vector <int> pos1(n), pos2(n);
    stack <pair<int, int>> st1, st2;
    for (int i = n - 1; i > -1; i--) {
        while (!st1.empty() && st1.top().first >= a[i]) {
            st1.pop();
        }
        if (st1.empty()) {
            pos1[i] = n;
        } else {
            pos1[i] = st1.top().second;
        }
        st1.push({a[i], i});
    }
    for (int i = 0; i < n; i++) {
        while (!st2.empty() && st2.top().first >= a[i]) {
            st2.pop();
        }
        if (st2.empty()) {
            pos2[i] = -1;
        } else {
            pos2[i] = st2.top().second;
        }
        st2.push({a[i], i});
    }
    for (int i = 0; i < m; i++) {
        ll time = t;
        int pos = b[i];
        while (pos != n) {
            if (time <= 0) {
                break;
            }
            ans = max(ans, pos - b[i] + time / a[pos]);
            int nxt = pos1[pos];
            if (nxt == n) {
                break;
            }
            ll w = 0;
            if (pos != 0) {
                w = pref[nxt - 1] - pref[pos - 1];
            } else {
                w = pref[nxt - 1];
            }
            time -= w;
            pos = pos1[pos];
        }
        pos = b[i]; time = t;
        while (pos != -1) {
            if (time <= 0) {
                break;
            }
            ans = max(ans, b[i] - pos + time / a[pos]);
            int nxt = pos2[pos];
            if (nxt == -1) {
                break;
            }
            ll w = 0;
            w = pref[pos] - pref[nxt];
            time -= w;
            pos = pos2[pos];
        }
    }
    cout << ans;
    return 0;
}
