// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

mt19937 rnd(69); // chrono::steady_clock::now().time_since_epoch().count()
#define all(x) x.begin(), x.end()
// #define int long long
#define ull unsigned long long
#define ld long double
#pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2")

signed main()
{
    ios_base::sync_with_stdio(false);
    int n, m, T, cur_t;
    cin >> n >> m >> T;
    vector<int> a(n);
    vector<int> b(m);
    vector<int> pref_a(n + 1, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        pref_a[i + 1] = pref_a[i] + a[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        b[i]--;
    }
    int ans = 0;
    for (int i = 0; i < m; i++) {
        int l = 0;
        int r = n;
        if (i) {
            l = b[i - 1];
        }
        if (i != m - 1) {
            r = b[i + 1];
        }
        for (int j = l; j < r; j++) {
            if (j >= b[i]) {
                cur_t = T - abs(pref_a[j] - pref_a[b[i]]);
            } else {
                cur_t = T - abs(pref_a[j + 1] - pref_a[b[i] + 1]);
            }
            if (cur_t < 0) continue;
            ans = max(ans, cur_t / a[j] + abs(j - b[i]));
        }
    }
    cout << ans;
    return 0;
}
