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

using namespace std;
#define int int64_t

mt19937 rng(time(nullptr));

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 start, 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]
		if (start < finish) {
			int left = start, right = finish + 1;
			while (right - left > 1) {
				int middle = (left + right) / 2;
				if (pref_sum[middle] - pref_sum[start] <= t)
					left = middle;
				else
					right = middle;
			}
			return left - start + max<int>(0, t - pref_sum[left] + pref_sum[start]) / a[finish];
		}
		else if (start == finish) {
			return t / a[finish];
		}
		return 0;
	};

	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(*it, i));
			++it;
		}
		if (it != b.end()) {
			ans = max(ans, cnt(*it, i));
			if (it != (--b.end())) {
				++it;
				ans = max(ans, cnt(*it, i));
			}
		}
		it = upper_bound(b.begin(), b.end(), i);
		if (it != b.end()) {
			ans = max(ans, cnt(*it, i));
		}
		//cout << ans << endl;
	}

	reverse(a.begin(), a.end());
	for (int& i : b) i = n - 1 - i;
	reverse(b.begin(), b.end());

	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(*it, i));
			++it;
		}
		if (it != b.end()) {
			ans = max(ans, cnt(*it, i));
			if (it != (--b.end())) {
				++it;
				ans = max(ans, cnt(*it, i));
			}
		}
		it = upper_bound(b.begin(), b.end(), i);
		if (it != b.end()) {
			ans = max(ans, cnt(*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;
}
