#ifdef _DEBUG
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cassert>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define int int64_t

void solve() {
	int n, m, t;
	cin >> n >> m >> t;
	vector<int> a(n), b(m);
	for (int& i : a) cin >> i;
	for (int& i : b) cin >> i;
	for (int& i : b) --i;
	sort(b.begin(), b.end());
	vector<int> pref_sum(n + 1, 0);
	for (int i = 1; i <= n; ++i) pref_sum[i] = pref_sum[i - 1] + a[i - 1];
	int ans = 0;

	auto cnt = [&](int l, int r, int finish) -> int {
		// r, r - 1, ..., l + 1
		// 2 3 5 1 [4, 2] => 1 + 5 = 6
		// 0 2 5 10 11
		// pref[r + 1] - pref[l + 1]
		int left = l, right = r;
		int cur = pref_sum[right] - pref_sum[l];
		while (right - left > 1) {
			int middle = (left + right) / 2;
			int curr = pref_sum[middle] - pref_sum[l];
			if (curr <= t) {
				left = middle;
			}
			else {
				right = middle;
			}
		}
		if (pref_sum[r] - pref_sum[left] <= t) {
			return r - left + max<int>(0, (t - (pref_sum[r] - pref_sum[l]))) / a[finish];
		}
		else if (pref_sum[r] - pref_sum[right] <= t) {
			return r - right + max<int>(0, (t - (pref_sum[r] - pref_sum[l]))) / a[finish];
		}
		else {
			return max<int>(0, (t - (pref_sum[r] - pref_sum[l]))) / a[finish];
		}
	};

	for (int i = 0; i < n; ++i) {
		auto it = lower_bound(b.begin(), b.end(), i);
		if (it != b.begin()) {
			--it;
			ans = max(ans, cnt(min(i, *it), max(i, *it), i));
			++it;
		}
		if (it != b.end()) {
			ans = max(ans, cnt(i, *it + (i != *it), i));
			if (it != (--b.end())) {
				++it;
				ans = max(ans, cnt(i, *it + (i != *it), i));
			}
		}
		//cout << ans << endl;
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int test = 1;
	//cin >> test;

	while (test--) {
		solve();
	}

	return 0;
}