#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;
	for (int ii = 0; ii < n; ++ii) {
		int i = ii;
		auto ind = lower_bound(b.begin(), b.end(), i);
		if (ind != b.begin()) {
			--ind;
			int j = *ind;
			if (j < i) swap(i, j);
			int cur = pref_sum[j] - pref_sum[i];
			int left = i, right = j + 1;
			while (right - left > 1) {
				int middle = (left + right) / 2;
				if (pref_sum[middle] - pref_sum[i] >= t) {
					left = middle;
				}
				else {
					right = middle;
				}
			}
			ans = max(ans, max<int>(0, (t - abs(cur))) / a[i] + left - i);
			++ind;
		}
		i = ii;
		if (ind != b.end()) {
			int j = *ind;
			if (j < i) swap(i, j);
			int cur = pref_sum[j] - pref_sum[i];
			int left = i, right = j + 1;
			while (right - left > 1) {
				int middle = (left + right) / 2;
				if (pref_sum[middle] - pref_sum[i] >= t) {
					left = middle;
				}
				else {
					right = middle;
				}
			}
			ans = max(ans, max<int>(0, (t - abs(cur))) / a[i] + left - i);
		}
		i = ii;
		if (ind != (--b.end()) && ind != b.end()) {
			++ind;
			int j = *ind;
			if (j < i) swap(i, j);
			int cur = pref_sum[j] - pref_sum[i];
			int left = i, right = j + 1;
			while (right - left > 1) {
				int middle = (left + right) / 2;
				if (pref_sum[middle] - pref_sum[i] >= t) {
					left = middle;
				}
				else {
					right = middle;
				}
			}
			ans = max(ans, max<int>(0, (t - abs(cur))) / a[i] + left - i);
		}
		i = ii;
		ind = upper_bound(b.begin(), b.end(), i);
		if (ind != b.end()) {
			int j = *ind;
			if (j < i) swap(i, j);
			int cur = pref_sum[j] - pref_sum[i];
			int left = i, right = j + 1;
			while (right - left > 1) {
				int middle = (left + right) / 2;
				if (pref_sum[middle] - pref_sum[i] >= t) {
					left = middle;
				}
				else {
					right = middle;
				}
			}
			ans = max(ans, max<int>(0, (t - abs(cur))) / a[i] + left - i);
		}
	}
	cout << ans << endl;
}

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

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

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

	return 0;
}