#include <bits/stdc++.h>

using namespace std;
using ll = long long;

pair<int,int> tree[1200002]; //

vector<int> a;

void build(int i,int l,int r){
    if (r-l==1){
        tree[i] = {l,l};
        return;
    }
    int m = (r+l)/2;
    build(i*2+1,l,m);
    build(i*2+2,m,r);
    auto [i1,i2] = tree[i*2+1];
    auto [j1,j2] = tree[i*2+2];
    if (a[i1] == a[j1]){
        tree[i] = {i1,j2};
        return;
    }
    if (a[i1]<a[j1]){
        tree[i] = {i1,i2};
    }else{
        tree[i] = {j1,j2};
    }
}

int search(int i,int l,int r,int q_l,int q_r){
    if (r<=q_l || q_r<=l){
        return a.size()-1;
    }
    if (q_l <= l && r<= q_r){
        return tree[i].first;
    }
    int m = (r+l)/2;
    int i1 = search(i*2+1,l,m,q_l,q_r);
    int i2 = search(i*2+2,m,r,q_l,q_r);
    if (a[i1]<a[i2]){
        return i1;
    }else{
        return i2;
    }
}

int search_left(int i,int l,int r,int val){
    if (r-l==1){
        return tree[i].first;
    }
    int m = (r+l)/2;
    if (a[tree[i].first]>=val){
        return a.size()-1;
    }
    if (a[tree[i*2+1].first]<val){
        return search_left(i*2+1,l,m,val);
    }else{
        return search_left(i*2+2,m,r,val);
    }
}

int search1(int i,int l,int r,int q_l,int q_r,int val){
    if (r<=q_l || q_r<=l){
        return a.size()-1;
    }
    if (q_l <= l && r<=q_r){
        return search_left(i,l,r,val);
    }
    int m = (r+l)/2;
    int i1 = search1(i*2+1,l,m,q_l,q_r,val);
    int i2 = search1(i*2+2,m,r,q_l,q_r,val);
    if (a[i1]<val){
        return i1;
    }else{
        return i2;
    }
}

// ===================

int search_right(int i,int l,int r,int val){
    if (r-l==1){
        return tree[i].second;
    }
    int m = (r+l)/2;
    if (a[tree[i].first]>=val){
        return a.size()-1;
    }
    if (a[tree[i*2+2].second]<val){
        return search_right(i*2+2,m,r,val);
    }else{
        return search_right(i*2+1,l,m,val);
    }
}

int search2(int i,int l,int r,int q_l,int q_r,int val){
    if (r<=q_l || q_r<=l){
        return a.size()-1;
    }
    if (q_l <= l && r<=q_r){
        return search_right(i,l,r,val);
    }
    int m = (r+l)/2;
    int i1 = search2(i*2+1,l,m,q_l,q_r,val);
    int i2 = search2(i*2+2,m,r,q_l,q_r,val);
    if (a[i2]<val){
        return i2;
    }else{
        return i1;
    }
}

int main(){
    int n,m,t;
    cin >> n >> m >> t;
    a.resize(n);
    a.push_back(INT_MAX);
    vector<int> b(m);
    for (int i=0;i<n;i++){
        cin >> a[i];
    }
    for (int i=0;i<m;i++){
        cin >> b[i];
        b[i]--;
    }

    build(0,0,n);

    vector<int> left(n),right(n);

    for (int i=0;i<n;i++){
        // cout << a[i] << ' ';
        // cout << search2(0,0,n,0,i,a[i]) << ' ' << search1(0,0,n,i+1,n,a[i]) << endl;
        left[i] = search2(0,0,n,0,i,a[i]);
        right[i] = search1(0,0,n,i+1,n,a[i]);
    }

    vector<int> pref(n+1,0);
    for (int i=0;i<n;i++){
        pref[i+1] = pref[i] + a[i];
    }
    int ans = 0;

    for (auto i : b){
        // cout << '!' << i << endl;
        ans = max(ans,t/a[i]);
        int i1 = right[i];
        while (i1!=n){
            int sum = pref[i1+1] - pref[i];
            // cout << i1 << ' ' << sum << endl;
            int ans1 = 0;
            if (t>=sum){
                ans1 += i1-i+1;
                ans1 += (t-sum)/a[i1];
            }else{
                break;
            }
            i1 = right[i1];
            ans = max(ans,ans1);    
            // cout << '?' << ans1 << endl;
        }
        // cout << "--" << endl;
        i1 = left[i];
        while (i1!=n){
            int sum = pref[i+1] - pref[i1];
            // cout << i1 << ' ' << sum << endl;
            int ans1 = 0;
            if (t>=sum){
                ans1 += i-i1+1;
                ans1 += (t-sum)/a[i1];
            }else{
                break;
            }
            ans = max(ans,ans1);
            // cout << '?' << ans1 << endl;
            i1 = left[i1];
        }
    }
    cout << ans;
}