/*#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")*/

#include <iostream>
#include <math.h>
#include <iostream>
#include <string>
#include <fstream>
#include <set>
#include <vector>
#include <algorithm>
#include <random>

using namespace std;
using ll = long long;
using ld = long double;
const ll MAXN = 5e3 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e18+8;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,m,T,a,cnt,res;
    cin >> n >> m >> T;
    vector<ll> arr(n);
    vector<ll> ans(n,0);
    vector<bool> queue(n,false);
    vector<ll> pref(n+1,0);
    for (int i = 0;i<n;i++){
        cin >> arr[i];
        pref[i+1] += arr[i] + pref[i];
    }
    for (int i = 0;i<m;i++){
        cin >> a;
        queue[a-1] = true;
    }
    res = 0;
    set<pair<ll,ll>> pred;
    for (int i = 0;i<n;i++){
        if (queue[i]){
            res = max(res,T/arr[i]);
            pred.insert({T/arr[i],i});
        }
        while (pred.size() > 0){
            pair<ll,ll> x = *pred.rbegin();
            pred.erase(x);
            if (pref[i] - pref[x.second] <= T){
                x.first = max(x.first,i - x.second + (T-(pref[i] - pref[x.second]))/arr[i]);
                res = max(res,x.first);
                pred.insert(x);
                break;
            }
        }
    }
    pred.clear();
    for (int i = n-1;i>-1;i--){
        if (queue[i]){
            res = max(res,T/arr[i]);
            pred.insert({T/arr[i],i});
        }
        while (pred.size() > 0){
            pair<ll,ll> x = *pred.rbegin();
            pred.erase(x);
            if (pref[x.second+1] - pref[i+1] <= T){
                x.first = max(x.first,x.second - i + (T-(pref[x.second+1] - pref[i+1]))/arr[i]);
                res = max(res,x.first);
                pred.insert(x);
                break;
            }
        }
    }
    cout << res << "\n";
}
