//#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 <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)

struct P {
	ll f, s;
};


ll get_sum(ll l, ll r, vector<ll>& pref) {
	if (!l) return pref[r];
	return pref[r] - pref[l - 1];
}

vector<ll> get_ans(vector<ll> &a, ll &n, ll &t) {
	vector<ll> pref(n, 0);
	pref[0] = a[0];
	for (int i = 1; i < n; ++i) {
		pref[i] = pref[i - 1] + a[i];
	}
	vector<ll> ans1(n, 0);
	for (int i = 0; i < n; ++i) {
		for (int j = i; j >= 0; --j) {
			ll d = get_sum(j, i, pref);
			if (d > t) break;
			ll x = i - j + 1 + (t - d) / a[j];
			ans1[i] = max(ans1[i], x);
		}
	}
	return ans1;
}


void solve() {
	ll n, m, t;
	cin >> n >> m >> t;
	vector<ll> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	vector<ll> b = a;
	reverse(all(b));
	vector<ll> ans1 = get_ans(a, n, t);
	vector<ll> ans2 = get_ans(b, n, t);
	reverse(all(ans2));
	vector<ll> ans(n);
	for (int i = 0; i < n; ++i) {
		ans[i] = max(ans1[i], ans2[i]);
	}
	ll answer = 0;
	for (int i = 0; i < m; ++i) {
		ll 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';
	}
}