#include <bits/stdc++.h>
using ll = long long;
#define int long long
using namespace std;
int n;
ll T;
vector <ll> pref;
vector <ll> val;

ll floor(ll a, ll b) {
    return (a + b - 1) / b;
}

ll cnt(int j, int i) {
    ll cr = T - (pref[j] - (i - 1 > -1 ? pref[i - 1] : 0ll));
    ll t;
    if (cr < 0) {
        t = -floor(-cr, val[j]);
    } else {
        t = cr / val[j];
    }
    return (ll) j - i + 1 + t;
}

ll get_ans(vector <ll> &a, vector <int> &used) {
    val = a;
    pref.assign(n, 0ll);
    for (int i = 0; i < n; i++) {
        pref[i] = val[i];
        if (i != 0) {
            pref[i] += pref[i - 1];
        }
    }
    ll ans = 0ll;
    for (int i = 0; i < n; i++) {
        if (!used[i]) continue;
        for (int j = i; j < n; j++) {
            ans = max(ans, cnt(j, i));
        }
    }
    return ans;
}

void solve() {
    int m;
    cin >> n >> m >> T;
    vector <ll> a(n, 0);
    vector <int> used_f(n, 0), used_s(n, 0);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int j = 0; j < m; j++) {
        int x; cin >> x;
        x--;
        used_f[x] = 1;
        used_s[n - 1 - x] = 1;
    }
    ll ans = get_ans(a, used_f);
    reverse(a.begin(), a.end());
    ans = max(ans, get_ans(a, used_s));
    cout << ans << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int test = 1;
    for (int i = 0; i < test; i++) {
        solve();
    }
}
