#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <tuple>
#include <deque>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int INF = 2 * 1e9;
const ll MAX = 1e15;
const ll MIN = -1e15;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-7;

#define int long long

void solve() {
    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 j = 0; j < m; j++) cin >> b[j], b[j]--;

    int ans = 0;
    for (int j = 0; j < m; j++) {
        int k = b[j], cur = t, cnt = 0;
        while (((j < m - 1 && k <= b[j + 1]) || (j == m - 1 && k < n)) && cur > 0) {
            ans = max(ans, cnt + cur / a[k]);
            cur -= a[k];
            cnt++, k++;
        }

        k = b[j], cur = t, cnt = 0;
        while (((j > 0 && k >= b[j - 1]) || (j == 0 && k >= 0)) && cur > 0) {
            ans = max(ans, cnt + cur / a[k]);
            cur -= a[k];
            cnt++, k--;
        }
    }
    cout << ans << endl;

}

signed main() {

    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int t = 1;
    //cin >> t;
    while (t--) solve();
}
