#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pi = pair<int , int>;
using vpi = vector<pi>;

#define int long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin() , x.rend()
#define f first
#define second


const int mod = 1e9 + 7;

ll summ(int a , int b , const int &mod) {
    return ((a + b) % mod + mod) % mod;
}
ll mn(int a , int b , const int &mod) {
    return ((a - b) % mod + mod) % mod;
}
ll umn(int a , int b , const int &mod) {
    return ((a * b) % mod + mod) % mod;
}
int binpow(int a , int p) {
    if (p == 0) return 1;
    if (p & 1) {
        return umn(a , binpow(a , p - 1) , mod);
    } else {
        int x = binpow(a , p / 2);
        return umn(x , x , mod);
    }
}

int del(int a , int b , const int &mod) {
    return umn(a , binpow(b , mod - 2) , mod);
}

int inf = 2e9;

void solve() {
    int n, m , t;
    cin >> n >> m >> t;
    vector<int> a(n) , l(n) , r(n) , b(m) , p(n + 1);
    for(int i = 0 ; i < n ; i++) {
        cin >> a[i];
        p[i + 1] = p[i] + a[i];
    }
    vector<int> cnt(n);
    for(int i = 0 ; i < m ; i++) {
        cin >> b[i];
        b[i]--;
        cnt[b[i]]++;
    }
    int last = -1;
    for (int i = 0 ; i < n ; i++) {
        l[i] = last;
        if (cnt[i]) last = i;
    }
    last = -1;
    for (int i = n - 1 ; i >= 0 ; i--) {
        r[i] = last;
        if(cnt[i]) last = i;
    }
    int mx = 0;
    for (int i = 0 ; i < n ; i++) {
        if (l[i] != -1) {
            int j = l[i];
            if (p[i] - p[j] <= t) {
                int sum = p[i] - p[j];
                mx = max(mx , i - j + (t - sum) / a[i]);
            }
        }
        if (r[i] != -1) {
            int j = r[i];
//            cout << i << ' ' << j << ' ' << p[j + 1] - p[i + 1]  << '\n';
            if (p[j + 1] - p[i + 1] <= t) {
                int sum = p[j + 1] - p[i + 1];
                mx = max(mx , j - i + (t - sum) / a[i]);
            }
        }
        if (cnt[i]) {
            mx = max(mx , t / a[i]);
        }
    }
    cout << mx;
}

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

    solve();
}

