#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <complex>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define ins insert
#define C complex<double>
#define X real()
#define Y imag()
using ll = long long;
using namespace std;

int main() {
	int n, m, T; cin >> n >> m >> T;
	vector<int> a(n), b(m);
	for (int& e : a) cin >> e;
	for (int& e : b) cin >> e;
	int ans = 0;
	for (int i = 0; i < m; i++) {
		int mx = 0, cur = 0, c = 0;
		for (int j = b[i]-1; j < n; j++) {
			cur += a[j];
			if (cur > T) break;
			c++;
			mx = max(mx, c + (T-cur) / a[j]);
		}
		cur = 0;
		c = 0;
		for (int j = b[i] - 1; j >= 0; j--) {
			cur += a[j];
			if (cur > T) break;
			c++;
			mx = max(mx, c + (T - cur) / a[j]);
		}
		ans = max(ans, mx);
	}
	cout << ans;
}