#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2,bmi")

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define endl "\n"
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

constexpr int INF = 2e13;
constexpr int MOD = 1e9 + 7;



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

    int n, m, T;
    cin >> n >> m >> T;
    vector<int> a(n), b(m);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<int> pref(n + 1);
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        b[i]--;
    }
    for (int i = 1; i <= n; i++) {
        pref[i] = pref[i - 1] + a[i - 1];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        auto id = lower_bound(b.begin(), b.end(), i) - b.begin();
        if (id != m) {
            ans = max(ans, (b[id] - i) + max(0ll, (T - (pref[b[id] + 1] - pref[i + 1]))) / a[i]);
        }
        id--;
        if (id == -1) continue;
        ans = max(ans, (i - b[id]) + max(0ll, (T - (pref[i] - pref[b[id]]))) / a[i]);
    }
    cout << ans;
}
