#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <random>
#include <map>
#include <queue>

using namespace std;
using ll = long long;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(0);

	ll n, m, t, rs = 0;
	cin >> n >> m >> t;
	vector<ll> a(n), r(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	vector<ll> pr(n + 1);
	for (int i = 1; i <= n; ++i) {
		pr[i] = pr[i - 1] + a[i - 1];
	}
	vector<ll> b(m);
	for (int i = 0; i < m; ++i) {
		cin >> b[i];
		--b[i];
	}
	int i1 = -1, i2 = 0;
	for (int i = 0; i < n; ++i) {
		while (i1 < m - 1 && b[i1 + 1] < i) {
			++i1;
		}
		while (i2 < m && b[i2] < i) {
			++i2;
		}
		if (i1 != -1 && pr[i] - pr[b[i1]] <= t) {
			rs = max(rs, (t - pr[i] + pr[b[i1]]) / a[i] + i - b[i1]);
		}
		if (i2 != m && pr[b[i2] + 1] - pr[i + 1] <= t) {
			rs = max(rs, (t - pr[b[i2] + 1] + pr[i + 1]) / a[i] + b[i2] - i);
		}
	}
	cout << rs;

	return 0;
}
