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

using namespace std;
using namespace __gnu_pbds;

auto seed = chrono::high_resolution_clock().now().time_since_epoch().count();
mt19937 rnd(seed);

template<typename T>
using orderet_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename V>
using table = gp_hash_table<T, V>;

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ld = long double;
using dd = double;

#define int ll

const ll INF = 1e18;

void solve(){
    int n, m, T;
    cin>>n>>m>>T;
    vector<int> v(n);
    for(int i = 0; i < n; ++i) cin>>v[i];
    int mx= 0;
    for(int i = 0; i < m; ++i){
        int j;
        cin>>j;
        j--;
        int ans = 0;
        ll sum = 0;
        for(int k = j; k < n; ++k){
            ans = max(ans, k - j + (T - sum) / v[k]);
            sum += v[k];
            if(sum > T) break;
        }
        sum = 0;
        for(int k = j; k >= 0; --k){
            ans = max(ans, j - k + (T - sum) / v[k]);
            sum += v[k];
            if(sum > T) break;
        }
        mx = max(mx, ans);
    }
    cout << mx;
}

signed main(){
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    //cin>>t;
    while(t--) solve();
}