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

using namespace std;

vector<long long> pref;

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

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