#include <bits/stdc++.h>
using namespace std;
const int maxn = 1 << 19;
int n;
double eps = 1e-9;
struct line{
    double k, b;
    double operator()(double x) {
        return k * x + b;
    }
    line(){
         k = 0;
         b = -1e9;
    }
    line(double _k, double _b) : k(_k), b(_b){
    }
};
int inter(line a, line b) {
    if (a.k - b.k < eps)
        return INT_MIN;
    return floor((b.b - a.b) / (a.k - b.k));
}
line t[maxn << 1];

void upd(int v, int nl, int nr, line a){
    int x = inter(a, t[v]);
    if (x < 0 || x >= n) {
        if (t[v](n / 2) > a(n / 2))
            return;
        else {
            t[v] = a;
            return;
        }
    }
    int nm = (nl + nr) / 2;
    if (x < nm)
        upd(2 * v + 1, nl, nm, a);
    else
        upd(2 * v + 2, nm, nr, a);
    x = inter(t[2 * v + 1], t[2 * v + 2]);
    if (x < nm)
        t[v] = t[2 * v + 2];
    else
        t[v] = t[2 * v + 1];
}

line get(int v, int nl, int nr, int x) {
    if (nr - nl == 1)
        return t[v];
    int nm = (nl + nr) >> 1;
    if (x < nm)
        return get(2 * v + 1, nl, nm, x);
    return get(2 * v + 2, nm, nr, x);
}

void clear() {
    fill(t, t + maxn * 2, line(0, 0));
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n;
    int m, tt;
    cin >> m >> tt;
    vector<int> a(n);
    for (auto &v : a)
        cin >> v;
    vector<int> b(m);
    for (auto &v : b)
        cin >> v;
    vector<long long> p(n + 1);
    partial_sum(a.begin(), a.end(), p.begin() + 1);
    vector<long long> ans(n);
    for (int i = 0; i < n; i++) {
        ans[i] = tt / a[i];
        for (int j = i - 1; j >= 0 &&  tt >= p[i + 1] - p[j + 1]; j--)
            ans[i] = max(ans[i], i - j + (tt - (p[i + 1] - p[j + 1])) / a[j]);
        for (int j = i + 1; j < n &&  tt >= p[j] - p[i]; j++)
            ans[i] = max(ans[i], j - i + (tt - (p[j] - p[i])) / a[j]);
    }
    long long rl = -1;
    for (auto &v : b)
        rl = max(rl, ans[v - 1]);
    cout << rl << "\n";
    return 0;
}