#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, m, T;
    cin >> n >> m >> T;
    vector<int> a(n), b(m);
    for (int &i : a){
        cin >> i;
    }
    for (int &i : b){
        cin >> i;
    }
    int ans = 0;
    for (int B = 0; B < m; ++B){
        int i = b[B] - 1;
        int has = a[i], c = 0;
        for (int j = i - 1; j >= 0; --j){
            c = max(c , i - j + (T - has) / a[j]);
            has += a[j];
        }
        has = a[i];
        for (int j = i + 1; j < n; ++j){
            c = max(c, j - i + (T - has) / a[j]);
            has += a[j];
        }
        ans = max(ans, c);
    }
    cout << ans << "\n";
}
