#include <fstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <cmath>
#include <algorithm>
using namespace std;

using ll = long long;

//                                              ВАНЯ ПАНИН 542 ЛЕГЕНДА!!!!!

const int maxn = 3e5;
const int inf = 1e9 + 239;


void solve() {
    int n, m;
    ll t;
    cin >> n >> m >> t;
    vector<ll> a(n);
    vector<ll> pref(n + 1);
    ll minx = inf;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        minx = min(minx, a[i]);
        pref[i + 1] = pref[i] + a[i];
    }
    vector<ll> st(m);
    for (int i = 0; i < m; i++) {
        cin >> st[i];
        st[i]--;
    }
    
    vector<int> left(n, -1);
    vector<int> right(n, -1);
    int j = 0;
    for (int i = 0; i < n; i++) {
        if (j < m - 1 && st[j + 1] == i) {
            j++;
        }
        if (st[j] > i) continue;
        left[i] = j;
    }
    j = m - 1;
    for (int i = n - 1; i >= 0; i--) {
        if (j > 0 && st[j - 1] == i) {
            j--;
        }
        if (st[j] < i) continue;
        right[i] = j;
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        if (left[i] != -1) {
            int j = left[i];
            ll dist = pref[i + 1] - pref[st[j]];
            ll cur = i - st[j] + 1;
            cur += (t - dist) / a[i];
            if (dist < t) {
                ans = max(ans, cur);
            }
        }
        if (right[i] != -1) {
            int j = right[i];
            ll dist = pref[st[j] + 1] - pref[i];
            ll cur = abs(i - st[j]) + 1;
            cur += (t - dist) / a[i];
            if (dist < t) {
                ans = max(ans, cur);
            }
        }
    }
    cout << ans;
}


//                                              ВАНЯ ПАНИН 542 ЛЕГЕНДА!!!!!


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
}

//                                              ВАНЯ ПАНИН 542 ЛЕГЕНДА!!!!!

