// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")

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

using namespace std;
// using namespace __gnu_pbds;

// #define int long long
// #define ordered_set tree<int, null_type, less<int>, tree_order_statistics_node_update, rb_tree_tag>


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> b(m);
    for (int i = 0; i < m; ++i) cin >> b[i];
    for (int i = 0; i < m; ++i) --b[i];
    vector<int> p(n + 1);
    for (int i = 0; i < n; ++i) p[i + 1] = p[i] + a[i];
    int curind = 0;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        while (curind < b.size() - 1 && abs(p[b[curind + 1]] - p[i]) < abs(p[b[curind]] - p[i])) curind++;
        if (abs(p[b[curind]] - p[i]) > t) continue;
        if (b[curind] <= i) ans = max(ans, abs(b[curind] - i) + (t - abs(p[b[curind]] - p[i])) / a[i]);
        else ans = max(ans, abs(b[curind] - i) + (t - abs(p[b[curind] + 1] - p[i])) / a[i]);
        // cout << b[curind] << ' ' << i << ' ' << ans << '\n';
    }
    cout << ans << '\n';
}

signed main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    solve();
}