#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];
	}
	for (int i = 0; i < n; ++i) {
		int i1 = lower_bound(b.begin(), b.end(), i) - b.begin();
		if (i1 != b.size()) {
			rs = max(rs, (t - pr[b[i1] + 1] + pr[i + 1]) / a[i] + b[i1] - i);
		}
		--i1;
		if (i1 != -1) {
			rs = max(rs, (t - pr[i] + pr[b[i1]]) / a[i] + i - b[i1]);
		}
	}
	cout << rs;

	return 0;
}
