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

using namespace std;

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

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