#include<bits/stdc++.h>
#pragma GCC target("avx2")
#define int long long
#define F first
#define S second

using namespace std;

const int N = 5e5+10;

int pref[N];

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
    int n, m, T;
    cin>>n>>m>>T;
    int a[n+10];
    for(int i = 1; i <= n; i++)
        cin>>a[i], pref[i] = pref[i-1]+a[i];
    vector<int> v;
    for(int i = 1; i <= m; i++)
    {
        int x; cin>>x; v.push_back(x);
    }
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        int r = upper_bound(v.begin(), v.end(), i)-v.begin();
        for(int j = max(0ll, r-2); j <= min(r, (int)v.size()-1); j++)
        {
            int x = v[j];
            if(i > x)
            {
                int len = pref[i]-pref[x-1];
                if(len > T) continue;
                ans = max(ans, (i-x+1)+(T-len)/a[i]);
            }
            else
            {
                int len = pref[x]-pref[i-1];
                if(len > T) continue;
                ans = max(ans, (x-i+1)+(T-len)/a[i]);
            }
        }
    }
    cout<<ans;
}

