#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <deque>
#include <iomanip>
#include <string>
#include <numeric>
#include <random>
#include <cmath>
using namespace std;
using ll = long long;
using ld = long double;
const ll INF = 1e18;


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, m; ll T;
	cin >> n >> m >> T;
	vector<ll> a(n), pref(n + 1, 0);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		pref[i + 1] = pref[i] + a[i];
	}
	vector<int> b(m);
	for (int i = 0; i < m; ++i) {
		cin >> b[i];
		b[i]--;
	}
	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		if (b.back() >= i) {
			int j = *lower_bound(b.begin(), b.end(), i);
			if (T >= pref[j] - pref[i]) {
				ans = max(ans, (ll)(j - i) + (T - (pref[j + 1] - pref[i + 1])) / a[i]);
				
			}
		}
		if (b[0] <= i) {
			int j = *prev(upper_bound(b.begin(), b.end(), i));
			if (T >= pref[i] - pref[j]) {
				ans = max(ans, (ll)(i - j) + (T - (pref[i] - pref[j])) / a[i]);
				//cout << (ll)(i - j) + (T - (pref[i] - pref[j])) / a[i] << " " << pref[i] - pref[j] << " " << i << " " << j << "\n";
			}
		}
	}
	cout << ans;

	return 0;
}