#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize("O3")

using namespace std;
//using namespace __gnu_pbds;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define int long long

//typedef tree<int, null_type,less<int>,  rb_tree_tag, tree_order_statistics_node_update> ordered_set;

signed main(){
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
    int n, m,T;
    cin>>n>>m>>T;
    vector<int> a(n);
    for(auto &x:a) cin>>x;
    vector<int> p(n+1);
    for(int i = 1; i <= n; ++i){
        p[i] = p[i-1] + a[i-1];
    }
    vector<int> b(m);
    for(auto &x:b) cin>>x, --x;
    vector<int> L(n), R(n);
    for(int i = 0; i < n; ++i){
        L[i] = i - 1;
        while(L[i] >= 0 && a[L[i]] >= a[i]) L[i] =L[L[i]];
    }
    for(int i = n - 1; i >= 0; --i){
        R[i] = i + 1;
        while(R[i] < n && a[R[i]] >= a[i]) R[i] = R[R[i]];
    }
    int ans = 0;

    auto get = [&](int l, int r) -> int{
        if (l > r) swap(l, r);
        if (p[r+1] - p[l] > T) return 0;
        return (T-(p[r+1]-p[l]))/min(a[l], a[r])+r-l+1;
    };

    for(int i = 0; i < n; ++i){
        auto it = upper_bound(b.begin(), b.end(), L[i]);
        if (it != b.end()){
            int j = *it;
            ans = max(ans, get(j,i));
        }
        it = lower_bound(b.begin(), b.end(), R[i]);
        if (it != b.begin()){
            --it;
            int j = *it;
            ans = max(ans, get(j,i));
        }
    }
    cout<<ans<<'\n';
    return 0;
}
