#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <ctime>
#include <chrono>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <deque>
#include <bitset>
#include <queue>
using namespace std;
mt19937_64 rnd(time(NULL));

const long long INF = 1e18, MOD = 1e9 + 7;

void solve()
{
	long long n, m, T;
	vector<long long> a, b;
	cin >> n >> m >> T;
	a.resize(n);
	for (long long i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	b.resize(m);
	for (long long i = 0; i < m; i++)
	{
		cin >> b[i];
		b[i]--;
	}

	vector<long long> pa(n + 1);
	for (long long i = 0; i < n; i++)
	{
		pa[i + 1] = pa[i] + a[i];
	}

	auto getsum = [&](long long l, long long r) -> long long
	{
		return pa[r + 1] - pa[l];
	};

	long long ans = 0;
	for (long long i = 0; i < n; i++)
	{
		long long idx = lower_bound(b.begin(), b.end(), i) - b.begin();
		if (idx != m)
		{
			long long dist = getsum(i + 1, b[idx]);
			if (dist <= T)
			{
				long long cur = b[idx] - i, rest = T - dist;
				cur += rest / a[i];
				ans = max(ans, cur);
			}
		}
		idx--;
		if (idx != -1)
		{
			long long dist = getsum(b[idx], i - 1);
			if (dist <= T)
			{
				long long cur = i - b[idx], rest = T - dist;
				cur += rest / a[i];
				ans = max(ans, cur);
			}
		}
	}
	cout << ans << "\n";
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

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

	return 0;
}

/*

























*/
