#include <bits/stdc++.h>

using namespace std;

using ll = long long;
#define x first
#define y second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

void solve();

int main() {
	cin.tie(nullptr)->sync_with_stdio(false);
	cout << fixed << setprecision(30);
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}

struct rat {
	ll x, y;
	rat() = default;
	rat(ll _x, ll _y) : x(_x), y(_y) {}
};

bool operator<(rat a, rat b) {
	return (__int128)1 * a.x * b.y < (__int128)1 * b.x * a.y;
}

rat my_max(rat a, rat b) {
	assert(a.y > 0);
	if (a < b) return b;
	return a;
}

struct line {
	ll k, b;
	line() = default;
	line(ll _k, ll _b) : k(_k), b(_b) {}
	rat operator[](ll x) {
		assert(k > 0);
		return rat(x + b, k);
	}
};

struct li_chao {
	struct node {
		line ln;
		node *l, *r;
		node(line _ln) {
			ln = _ln;
			l = nullptr;
			r = nullptr;
		}
	};
	node *root;
	size_t sz;
	ll left;
	li_chao(ll n, ll _left) : left(_left) {
		root = nullptr;
		sz = 1;
		while (sz < n) sz <<= 1;
	}
	void insert(line ln) {
		root = _insert(ln, left, left + sz - 1, root);
	}
	node *_insert(line ln, ll l, ll r, node *i) {
		if (!i) {
			return new node(ln);
		}
		ll m = (l + r) / 2;
		if (i->ln[m] < ln[m]) {
			swap(ln, i->ln);
		}
		if (i->ln[l] < ln[l]) {
			i->l = _insert(ln, l, m, i->l);
		} else {
			i->r = _insert(ln, m + 1, r, i->r);
		}
		return i;
	}
	rat get_max(ll idx) {
		return _get_max(idx, left, left + sz - 1, root);
	}
	rat _get_max(ll idx, ll l, ll r, node *i) {
		if (!i) {
			return {0, 1};
		}
		ll m = (r + l) / 2;
		if (idx <= m) {
			return my_max(i->ln[idx], _get_max(idx, l, m, i->l));
		}
		return my_max(i->ln[idx], _get_max(idx, m + 1, r, i->r));
	}
	void rec_del(node *i) {
		if (!i) return;
		rec_del(i->l);
		rec_del(i->r);
		delete i;
	}
	~li_chao() {
		rec_del(root);
	}
};

void solve() {
	int n, m, T;
	cin >> n >> m >> T;
	vector<int> a(n), b(m);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}
	vector<ll> dp(n, 0);
	{
		vector<ll> pref(n);
		pref[0] = a[0];
		for (int i = 1; i < n; i++) {
			pref[i] = pref[i - 1] + a[i];
		}
		li_chao lc(300'300 * 1'000'000'000ll, -300'100 * 1'000'000'000ll);
		for (int i = 0; i < n; i++) {
			lc.insert({a[i], T + pref[i] - 1ll * i * a[i]});
			rat res = lc.get_max(-pref[i]);
			ll upd = res.x / res.y;
			if (res.y < 0 && res.x % res.y) {
				upd--;
			}
			dp[i] = max<ll>(dp[i], i + upd);
		}
	}
	reverse(all(a));
	{
		vector<ll> pref(n);
		pref[0] = a[0];
		for (int i = 1; i < n; i++) {
			pref[i] = pref[i - 1] + a[i];
		}
		li_chao lc(300'300 * 1'000'000'000ll, -300'100 * 1'000'000'000ll);
		for (int i = 0; i < n; i++) {
			lc.insert({a[i], T + pref[i] - 1ll * i * a[i]});
			rat res = lc.get_max(-pref[i]);
			ll upd = res.x / res.y;
			if (res.y < 0 && res.x % res.y) {
				upd--;
			}
			dp[n - i - 1] = max<ll>(dp[n - i - 1], i + upd);
		}
	}
	ll ans = 0;
	for (int i = 0; i < m; i++) {
		ans = max(ans, dp[b[i] - 1]);
	}
	cout << ans << '\n';
}
