//#pragma GCC target("avx, avx2")
#pragma GCC optimize("O3, Ofast, unroll-loops")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <iomanip>
#include <random>
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <set>


using namespace std;
using ll = long long;
const ll MAX = 1e18;
const ll MIN = -1e18;

#define all(a) a.begin(), a.end()
#define each(x, a) for(auto &x : a)



int get_sum(int l, int r, vector<int>& pref) {
	if (!l) return pref[r];
	return pref[r] - pref[l - 1];
}
/*
struct line {
	int k = MIN, b;
};
int get_inter(line l1, line l2) {
	return (l2.b - l1.b) / (l1.k - l2.k);
}
vector<line> lines;
void add_line(int k, int b) {
	if(lines.back().k )
	int sz = lines.size();
	while (sz >= 2 &&
		get_inter(lines[sz - 1], lines[sz - 2]) < get_inter(lines[sz - 1], { k, b })) {
		lines.pop_back();
		sz = lines.size();
	}
	lines.push_back({ k, b });
}
int get_opt(int x) {
	int l = 0, r = lines.size() - 1;
	while (r - l > 1) {
		int m = (l + r) / 2;
		if (get_inter(lines[m], lines[m + 1]) > x) {
			r = m;
		}
		else {
			l = m;
		}
	}

}*/

vector<int> get_ans(vector<int>& a, int& n, int& t) {
	vector<int> pref(n, 0);
	pref[0] = a[0];
	for (int i = 1; i < n; ++i) {
		pref[i] = pref[i - 1] + a[i];
	}
	vector<int> ans1(n, 0);
	int i1 = 0;
	deque<int> mins;
	for (int i = 0; i < n; ++i) {
		while (get_sum(i1, i, pref) > t) {
			i1++;
		}
		if (i1 > i) continue;
		while (!mins.empty() && a[mins.back()] >= a[i]) {
			mins.pop_back();
		}
		while (!mins.empty() && mins.front() < i1) {
			mins.pop_front();
		}
		mins.push_back(i);
		/*if (mins.empty()) {
			ans1[i] = a[i] / t;
		}
		else {
		}*/
		int j = mins.front();
		int d = get_sum(j, i, pref);
		int x = i - j + 1 + (t - d) / a[j];
		ans1[i] = max(ans1[i], x);
		auto it = mins.rbegin();
		int cnt = 0;
		while (cnt < 100 && it != mins.rend()) {
			j = *it;
			d = get_sum(j, i, pref);
			x = i - j + 1 + (t - d) / a[j];
			ans1[i] = max(ans1[i], x);
			it++;
		}
	}
	return ans1;
}


void solve() {
	int n, m, t;
	cin >> n >> m >> t;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	vector<int> b = a;
	reverse(all(b));
	vector<int> ans1 = get_ans(a, n, t);
	vector<int> ans2 = get_ans(b, n, t);
	reverse(all(ans2));
	vector<int> ans(n);
	for (int i = 0; i < n; ++i) {
		ans[i] = max(ans1[i], ans2[i]);
	}
	int answer = 0;
	for (int i = 0; i < m; ++i) {
		int x;
		cin >> x;
		answer = max(answer, ans[x - 1]);
	}
	cout << answer;
}


signed main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll t = 1;
	//cin >> t;
	while (t--) {
		solve();
		cout << '\n';
	}
}