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

using namespace std;

vector<int64_t> calc(vector<int64_t> a, int64_t T) {
	int64_t n = a.size();
	vector<int64_t> p(n + 1);
	for (int64_t i = 1; i <= n; ++i) {
		p[i] = p[i - 1] + a[i - 1];
	}
	int64_t l = 0, r = 1;
	vector<int64_t> ans(n);
	ans[0] = T / a[0];
	while (r < n) {
		if (a[r] > T) {
			ans[r] = 0;
		}
		else {
			/*while (p[r + 1] - p[l] > T && l < r) {
				++l;
			}*/
			/*ans[r] = (r - l + 1) + ((T - (p[r + 1] - p[l])) / a[l]);*/
			l = max(0, l - 20);
			while (l <= r) {
				/*if (ans[r] < (r - (l + 1) + 1) + ((T - (p[r + 1] - p[l + 1])) / a[l + 1])) {
					++l;*/
				if (T >= p[r + 1] - p[l]) {
					ans[r] = max(ans[r], (r - l + 1) + ((T - (p[r + 1] - p[l])) / a[l]));
				}
				++l;
				/*}
				else {
					break;
				}*/
			}
		}
		++r;
	}
	return ans;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int64_t n, m, T;
	cin >> n >> m >> T;
	vector<int64_t> a(n);
	vector<int64_t> b(n);
	for (int64_t i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for (int64_t i = 0; i < m; ++i) {
		int64_t x;
		cin >> x;
		x--;
		b[x] = 1;
	}
	vector<int64_t> ans1 = calc(a, T);
	reverse(a.begin(), a.end());
	vector<int64_t> ans2 = calc(a, T);
	reverse(ans2.begin(), ans2.end());
	int64_t res = 0;
	for (int64_t i = 0; i < n; ++i) {
		if (b[i]) {
			res = max(res, max(ans1[i], ans2[i]));
		}
	}
	cout << res << '\n';
	return 0;
}