#ifdef _DEBUG
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cassert>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define int int64_t

void solve() {
	int n, m, t;
	cin >> n >> m >> t;
	vector<int> a(n);
	for (int& x : a) cin >> x;
	vector<int> b(m);
	for (int& x : b) cin >> x;
	for (int& x : b) --x;
	vector<int> pref(n + 1, 0);
	for (int i = 1; i <= n; ++i) pref[i] = pref[i - 1] + a[i - 1];
	// a[i] <= a[i + 1]
	int ans = 0;
	int cur_time = 0;
	for (int j = b[0]; j > 0; --j) {
		cur_time += a[j];
		if (cur_time <= t) ++ans;
	}
	cout << ans + max<int>(0, t - cur_time) / a[0] << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int test = 1;
	//cin >> test;

	while (test--) {
		solve();
	}

	return 0;
}