//#pragma GCC optimize("O3, unroll-loops, no-stack-protector")
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#define int long long

using namespace std;

const int INF = 2e15;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m, t;
	cin >> n >> m >> t;
	vector <int> arr(n), pref(n + 1), brr(m);
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		pref[i + 1] = pref[i] + arr[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> brr[i];
		brr[i]--;
	}
	vector <int> hl(n), hr(n);
	stack <pair<int, int>> st;
	for (int i = 0; i < n; i++) {
		while (!st.empty() && st.top().first >= arr[i]) {
			st.pop();
		}
		if (st.empty()) {
			hl[i] = -1;
		}
		else {
			hl[i] = st.top().second;
		}
		st.push({ arr[i], i });
	}
	st = {};
	for (int i = n - 1; i >= 0; i--) {
		while (!st.empty() && st.top().first >= arr[i]) {
			st.pop();
		}
		if (st.empty()) {
			hr[i] = n;
		}
		else {
			hr[i] = st.top().second;
		}
		st.push({ arr[i], i });
	}
	vector <int> cnt(n);
	for (int i = 0; i < n; i++) {
		int maxi = 0;
		int ind = i;
		while (ind != -1 && pref[i + 1] - pref[ind] <= t) {
			maxi = max(maxi, (t - (pref[i + 1] - pref[ind])) / arr[ind] + i - ind + 1);
			ind = hl[ind];
		}
		ind = i;
		while (ind != n && pref[ind + 1] - pref[i] <= t) {
			maxi = max(maxi, (t - (pref[ind + 1] - pref[i])) / arr[ind] + ind - i + 1);
			ind = hr[ind];
		}
		cnt[i] = maxi;
	}
	int ans = 0;
	for (auto el : brr) {
		ans = max(ans, cnt[el]);
	}
	cout << ans << '\n';
}
