#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <set>
#include <random>

using namespace std;

vector<long long> pref;

long long get(long long l, long long r) {
    if (r < l) {
        swap(l, r);
    }
    return pref[r + 1] - pref[l];
}

int main()
{
    long long n, m, t;
    cin >> n >> m >> t;
    vector<long long> v(n);
    for (long long i = 0; i < n; i++) {
        cin >> v[i];
    }
    pref.resize(n + 1);
    for (long long i = 0; i < n; i++) {
        pref[i + 1] = pref[i] + v[i];
    }
    long long res = 0;
    for (long long i = 0; i < m; i++) {
        long long b;
        cin >> b;
        b--;
        for (long long j = max(0ll, b - 21); j < min(n, b + 21); j++) {
            long long tm = t - get(b, j);
            long long cnt = abs(b - j) + 1;
            if (tm >= 0) {
                res = max(res, cnt + tm / v[j]);
            }
        }
    }
    cout << res;
    
    
    return 0;
}