#include <iostream>
#include <vector>
using namespace std;


long long f(long long a, long long b) {
    return (a - a % b) / b;
}


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long long n, m, t, sum;
	cin >> n >> m >> t;
	vector<long long> a(n);
	for (long long i = 0; i < n; i++)
		cin >> a[i];
	vector<long long> l(n), res_l(n);
	l[0] = 0, res_l[0] = t / a[0], sum = 0;
	for (long long i = 1; i < n; i++) {
		sum += a[i];
		if (a[i] > a[l[i - 1]] && i - l[i - 1] + f(t - sum, a[l[i - 1]]) > f(t, a[i]) && t >= sum)
			l[i] = l[i - 1], res_l[i] = i - l[i - 1] + f(t - sum, a[l[i - 1]]);
		else
			l[i] = i, res_l[i] = f(t, a[i]), sum = 0;
	}
	vector<long long> r(n), res_r(n);
	r[n - 1] = n - 1, res_r[n - 1] = t / a[n - 1], sum = 0;
	for (long long i = n - 2; i >= 0; i--) {
		sum += a[i];
		if (a[i] > a[r[i + 1]] && r[i + 1] - i + f(t - sum, a[r[i + 1]]) > f(t, a[i]) && t >= sum)
			r[i] = r[i + 1], res_r[i] = r[i + 1] - i + f(t - sum, a[r[i + 1]]);
		else
			r[i] = i, res_r[i] = f(t, a[i]), sum = 0;
	}
	long long b, ans = 0;
	for (long long i = 0; i < m; i++) {
		cin >> b;
		b--;
		ans = max(ans, max(res_l[b], res_r[b]));
		//cout << b << " || " << res_l[b] << ' ' << l[b] << " || " << res_r[b] << ' ' << r[b] << '\n';
	}
	cout << ans << '\n';
}

