#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define db long double

using namespace std;
//using namespace __gnu_pbds;
//using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
    int n, m, T, ans = 0; cin >> n >> m >> T;

    vector<int> a(n), pref_sm(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        pref_sm[i + 1] = pref_sm[i] + a[i];
    }

    unordered_set<int> st;
    for (int i = 0; i < m; ++i) {
        int x; cin >> x;
        st.insert(x - 1);
    }

    for (int i : st) {
        for (int j = 0; j < n; ++j) {
            int cur_ans = abs(i - j) + 1;

            int sm = pref_sm[max(i, j) + 1] - pref_sm[min(i, j)];
            if (T >= sm) {
                sm = T - sm;

                cur_ans += sm / a[j];

                ans = max(ans, cur_ans);
            }
        }
    }

    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int tt = 1;
    while (tt--) {
        solve();
        cout << "\n";
    }
}