//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <iomanip>

using namespace std;

long long n, m, t;
vector<long long> v1, v2, zap;

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

	cin >> n >> m >> t;

	v1.resize(n);
	v2.resize(n);
	zap.resize(m);

	for (long long i = 0; i < n; ++i)
		cin >> v1[i];

	for (long long i = 0; i < m; ++i) {
		cin >> zap[i];
		--zap[i];
	}

	for (long long h = 0; h < m; ++h) {
		long long i = zap[h];
		long long x3 = t / v1[i], sum = v1[i];
		long long l = 0, r = n - 1;
		if (h > 0)
			l = zap[h - 1] + 1;
		if (h < m - 1)
			r = zap[h + 1] - 1;
		for (long long j = i + 1; j <= r; ++j) {
			x3 = max(x3, j - i + (t - sum) / v1[j]);
			sum += v1[j];
			if (sum >= t)
				break;
		}
		sum = v1[i];
		for (long long j = i - 1; j >= l; --j) {
			x3 = max(x3, i - j + (t - sum) / v1[j]);
			sum += v1[j];
			if (sum >= t)
				break;
		}
		v2[i] = x3;
	}
	long long ans = 0;
	for (long long i = 0; i < m; ++i) {
		long long a = zap[i];
		ans = max(ans, v2[a]);
	}
	cout << ans;
	return 0;
};
