#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, m, t; cin >> n >> m >> t;
    vector<int> a(n), b(m);
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = 0; i < m; ++i) cin >> b[i];
    vector<pair<int, int>> aa(n);
    for (int i = 0; i < n; ++i) aa[i] = {a[i], i};
    sort(aa.begin(), aa.end());
    vector<int> pr(n+1); pr[0] = 0;
    for (int i = 0; i < n; ++i) pr[i+1] = pr[i] + a[i];
    int ans = 0;
    for (int i : b){
        i--;
        for (int j = i; j >= 0; --j) ans = max(ans, i - j + (t - pr[i+1] + pr[j+1])/a[j]);
        for (int j = i; j < n; ++j) ans = max(ans, j - i + (t - pr[j] + pr[i])/a[j]);
    }
    cout << ans;
}
