#define _CRT_SECURE_NO_WARNINGS
#ifndef _DEBUG
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#endif
#include <iostream>
#include <iomanip>
#include <cmath>
#include <chrono>
#include <random>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <vector>
#include <deque>
#include <queue>


using namespace std;
#define int long long
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using pii = pair<int, int>;
auto sd = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rnd(sd);
using str = string;

void solve1() {
	ll n, m, T;
	cin >> n >> m >> T;
	vector<ll> a(n);
	vector<ll> pre(n + 1);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		pre[i + 1] = a[i] + pre[i];
	}
	vector<ll> b(m);
	for (int i = 0; i < m; i++) {
		cin >> b[i];
		b[i]--;
	}
	ll cur_i = 0;
	ll cur_j =0;
	vector<ll> mx_ans(n, 0);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (b[j] <= i) {
				cur_i =j;
			}
		}
		for (int j = m - 1; j >= 0; j--) {
			if (b[j] > i) {
				cur_j = j;
			}
		}
		ll i1 = b[cur_i];
		ll j1 = b[cur_j];
		if (i1 <= i) {
			ll ost = T - (pre[i + 1] - pre[i1]);
			if (ost >= 0) {
				ll sum = ost / a[i] + (abs(i - i1) + 1);
				mx_ans[i] = max(mx_ans[i], sum);
			}
		}
		if (j1 > i) {
			ll ost = T - (pre[j1 + 1] - pre[i]);
			if (ost >= 0) {
				ll sum = ost / a[i] + (abs(i - j1) + 1);
				mx_ans[i] = max(mx_ans[i], sum);
			}
		}
	}
	ll mx = 0;
	for (int i = 0; i < n; i++) {
		mx = max(mx, mx_ans[i]);
	}
	cout << mx;
}

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

#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	ll t1 = 1;
	//cin >> t1;
	while (t1 > 0) t1--, solve1();
}

