#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <string>

#define len(v) (int)((v).size())
#define ss second
#define ff first


typedef long long ll;

using namespace std;

const ll inf = 1e12 + 7;




void solve() {
	int n, m, t;
	cin >> n >> m >> t;

	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}

	vector<int> b(m);
	for (int i = 0; i < m; ++i) {
		cin >> b[i];
		--b[i];
	}
	
	vector<ll> pr(n + 1);
	for (int i = 0; i < n; ++i) {
		pr[i + 1] = pr[i] + a[i];
	}

	vector<int> l(n, -1), r(n, n);
	vector<bool> us(n, false);
	for (int i = 0; i < m; ++i) {
		us[b[i]] = true;
	}
	
	int ls = -1;
	for (int i = 0; i < n; ++i) {
		if (us[i]) ls = i;
		l[i] = ls;
	}

	ls = n;
	for (int i = n - 1; i >= 0; --i) {
		if (us[i]) ls = i;
		r[i] = ls;
	}

	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		if (l[i] > -1 && pr[i] - pr[l[i]] <= t) {
			ans = max(ans, (t - (pr[i] - pr[l[i]])) / a[i] + (i - l[i]));
		}
		if (r[i] < n && pr[r[i] + 1] - pr[i + 1] <= t) {
			ans = max(ans, (t - (pr[r[i] + 1] - pr[i + 1])) / a[i] + (r[i] - i));
		}
	}
	cout << ans << '\n';
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cout.precision(30);

	int t = 1;
//	cin >> t;
	while (t--) solve();
}



