#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n, m, t;
    cin >> n >> m >> t;
    vector<int> a(n);
    for (auto& el : a)
        cin >> el;
    vector<int> has(n);
    for (int i = 0; i < m; ++i) {
        int bi;
        cin >> bi;
        has[bi - 1] = 1;
    }
    vector<int> pref(n);
    for (int i = 0; i < n; ++i) {
        pref[i] = (i ? pref[i - 1] : 0ll) + a[i];
    }
    auto getsum = [&](int l, int r) {
        if (l > r)
            return 0ll;
        if (!l)
            return pref[r];
        return pref[r] - pref[l - 1];
        };
    int optl = 0;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (has[i]) {
            for (int j = i; j >= 0; --j) {
                if (getsum(j + 1, i) > t)
                    break;
                int curans = i - j + (t - getsum(j + 1, i)) / a[j];
                ans = max(ans, curans);
            }
            for (int j = i + 1; j < n; ++j) {
                if (getsum(i, j - 1) > t)
                    break;
                int curans = j - i + (t - getsum(i, j - 1)) / a[j];
                ans = max(ans, curans);
            }
        }
    }
    cout << ans;
}