#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <array>
#include <queue>

using namespace std;
typedef long long ll;
typedef long double ld;
#define all(a) a.begin(), a.end()

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n, m, t;
	cin >> n >> m >> t;
	vector<ll> a(n), isb(n, 0), pra(n+1, 0);
	for (ll i = 0; i < n; i++) cin >> a[i], pra[i + 1] = a[i] + pra[i];
	for (ll i = 0; i < m; i++) {
		ll x;
		cin >> x;
		isb[x - 1] = 1;
	}
	ll prev = -1, ans = 0;
	for (ll i = 0; i < n; i++) {
		if (isb[i]) prev = i;
		if (prev >= 0) {
			if (pra[i] - pra[prev] <= t) {
				ans = max(ans, i - prev + (t - pra[i] + pra[prev]) / a[i]);
			}
		}
	}
	prev = -1;
	for (ll i = n - 1; i >= 0; i--) {
		if (isb[i]) prev = i;
		if (prev >= 0) {
			if (pra[prev + 1] - pra[i + 1] <= t) {
				ans = max(ans, prev - i + (t - pra[prev + 1] + pra[i + 1]) / a[i]);
			}
		}
	}
	cout << ans << "\n";
	return 0;
}