#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <math.h>
#include <string>
#include <vector>
#include <chrono>
#include <random>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
#include <set>
#define endl '\n'

using namespace std;
using i64 = long long;
using ld = long double;

const i64 INF = 1e18 + 5;

mt19937 rnd(29);

i64 gcd_ext(i64 a, i64 b, i64& x, i64& y) {
	if (b == 0) {
		x = 1; y = 0;
		return a;
	}
	i64 x1 = 0, y1 = 0;
	i64 c = gcd_ext(b, a % b, x1, y1);
	x = y1, y = (-y1 * (a / b) + x1);
	return c;
}

i64 gcd(i64 a, i64 b) {
	while (b) swap(b, a %= b);
	return a;
}

const i64 S = 3e5 + 10;
i64 a[S], b[S], ex[S], pref[S], getTim[S];

bool num(i64 l, i64 r) {
	return (pref[r] - pref[l - 1]) > 0;
}

i64 cnt(i64 l, i64 r) {
	return getTim[r] - getTim[l - 1];
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	i64 n, m, t; cin >> n >> m >> t;

	for (i64 x = 1; x <= n; ++x) {
		cin >> a[x];
		getTim[x] = getTim[x - 1] + a[x];
	}

	for (i64 x = 1; x <= m; ++x) {
		cin >> b[x];
		ex[b[x]] = 1;
	}

	for (i64 x = 1; x <= n; ++x) {
		pref[x] = pref[x - 1] + ex[x];
	}

	i64 ans = 0;

	for (i64 x = 1; x <= n; ++x) {
		if (ex[x]) {
			ans = max(ans, t / a[x]);
		}
		else {
			i64 l = x, r = n + 1;
			while (r - l > 1) {
				i64 m = (l + r) / 2;
				if (num(x, m)) r = m;
				else l = m;
			}
			if (r != n + 1) {
				if (cnt(x + 1, r) <= t) {
					ans = max(ans, (r - x) + (t - cnt(x + 1, r)) / a[x]);
				}
			}

			l = 0, r = x;
			while (r - l > 1) {
				i64 m = (l + r) / 2;
				if (num(m, x)) l = m;
				else r = m;
			}
			if (l != 0) {
				if (cnt(l, x - 1) <= t) {
					ans = max(ans, (x - l) + (t - cnt(l, x - 1)) / a[x]);
				}
			}
		}
	}

	cout << ans;
}