#include <bits/stdc++.h>
using namespace std;
#define max(a, b) ((a) < (b) ? b : a)
#pragma optimize("O3")
#pragma optimize("unroll-loops")
int n, m, tt;
const int maxn = 3e5 + 100;
int a[maxn], b[maxn];
long long p[maxn];
long long ans[maxn];
vector<int> d;
mt19937 gen;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n;
    cin >> m >> tt;
    d.reserve(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < m; i++)
        cin >> b[i];
    for (int i = 0; i < n; i++)
        p[i + 1] = p[i] + a[i];
    for (int i = 0; i < n; i++)
        ans[i] = tt / a[i];
    long long bb;
    for (int i = 1; i < n; i++) {
        while (!d.empty() && a[d.back()] > a[i - 1])
            d.pop_back();
        d.push_back(i - 1);
        int h = max(0, int(d.size()) - 450);
        for (int r = 0; r < 100; r++) {
            int j = d[gen() % (d.size())];
            bb = i - j + (tt - (p[i + 1] - p[j + 1])) / a[j];
            ans[i] = max(ans[i], bb);
        }
    }
    d.clear();
    for (int i = n - 2; i >= 0; i--) {
        while (!d.empty() && a[d.back()] > a[i + 1])
            d.pop_back();
        d.push_back(i + 1);
        int h = max(0, int(d.size()) - 450);
        for (int r = 0; r < 100; r++) {
            int j = d[gen() % d.size()];
            bb = j - i + (tt - (p[j] - p[i])) / a[j];
            ans[i] = max(ans[i], bb);
        }
    }
    long long rl = -1;
    for (auto &v : b)
        rl = max(rl, ans[v - 1]);
    cout << rl << "\n";
    return 0;
}