#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

//#include <ext/pb_ds/assoc_containe.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

//template <class T> order_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//find_by_orede, order_of_key

#define int long long
#define all(a) (a).begin(), (a).end()

#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")


const int inf = 1e18;

int n, m, t;
vector<int> pref, a;

int get(int i, int j) {
	if (i >= j) return pref[i + 1] - pref[j + 1];
	return pref[j] - pref[i];
}

int check(int i, int j) {
	if (get(i, j) > t) return -inf;

	return abs(i - j) + (t - get(i, j)) / a[j];
}

const int DV = 300;
int cnt = 0;
int i;

int Get(int l, int r) {
	while (r - l > 2) {
		int m1 = l + (r - l) / 3;
		int m2 = r - (r - l) / 3;
		if (check(i, m1) > check(i, m2)) r = m2;
		else l = m1;
	}
	for (int j = max(l - DV, (int)0); j < min(r + DV, n); ++j)
		cnt = max(cnt, check(i, j));
	return cnt;
}

void solve() {
	 cin >> n >> m >> t;
	a.resize(n);
	pref.resize(n + 1);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		pref[i + 1] = pref[i] + a[i];
	}

	while (m--) {
		cin >> i; --i;
		//cnt = max(cnt, Get(0, min(i + 53, n)));
		//cnt = max(cnt, Get(max(i - 53, (int)0), i));
		cnt = max(cnt, Get(max(i - 60878, (int)0), min(i + 60799, n)));
	}
	cout << cnt;
}

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

#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int t = 1; //cin >> t;
	while (t--) solve();
}