#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll infll = 1e18;

template<typename T>
istream& operator>>(istream& is, vector<T>& a) {
	for (auto& i : a) {
		is >> i;
	}
	return is;
}

int32_t main() {
#ifdef LOCAL
	assert(freopen("C:\\Users\\User\\input.txt", "r", stdin));
#else
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
#endif
	int n, m, t;
	cin >> n >> m >> t;
	vector<int> a(n), b(m);
	cin >> a >> b;
	for (auto& i : b) {
		--i;
	}
	vector<ll> pref(n + 1);
	for (int i = 1; i <= n; ++i) {
		pref[i] = pref[i - 1] + a[i - 1];
	}
	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		int j = lower_bound(b.begin(), b.end(), i) - b.begin();
		if (j > 0) {
			ll cur = pref[i] - pref[b[j - 1]];
			if (cur <= t) {
				ans = max(ans, i - b[j - 1] + (t - cur) / a[i]);
			}
		}
		if (j < (int)b.size()) {
			ll cur = pref[b[j] + 1] - pref[i + 1];
			if (cur <= t) {
				ans = max(ans, b[j] - i + (t - cur) / a[i]);
			}
		}
	}
	cout << ans << "\n";
	return 0;
}