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

using namespace std;
using namespace __gnu_pbds;

#define int long long

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)((x).size()))

using ll = long long;
using ld = long double;

const ll INF = 3e18;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

template <typename T> void chmax(T &a, T b) {
    if (b > a)
        a = b;
}
template <typename T> void chmin(T &a, T b) {
    if (b < a)
        a = b;
}
void solve() {
    int n, m, t;
    cin >> n >> m >> t;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> p(n + 1);
    for (int i = 1; i <= n; ++i) {
        p[i] = p[i - 1] + a[i - 1];
    }
    int ans = 0;
    vector<int> b(m);
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
        --b[i];
    }
    for (int i = 0; i < n; ++i) {
        // будем бесконечно прыгать по дорожке i
        auto it = lower_bound(all(b), i) - b.begin();
        if (it != m) {
            int from = b[it];
            int tm = p[from + 1] - p[i + 1];
            if (tm <= t) {
                int extra = t - tm;
                chmax(ans, extra / a[i] + from - i);
            }
        }
        if (it != 0) {
            --it;
            int from = b[it];
            int tm = p[i] - p[from];
            if (tm <= t) {
                int extra = t - tm;
                chmax(ans, extra / a[i] + i - from);
            }
        }
    }
    cout << ans << '\n';
}

signed main() {
#ifdef LOCALEGOR
    freopen("INPUT.txt", "r", stdin);
#else
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
    int tt = 1;
    // cin >> tt;
    while (tt--) {
        solve();
    }
}
