//#pragma GCC optimize("unroll-loops", "Ofast")
//#pragma GCC target("sse","sse2","avx","avx2")
#include <bits/stdc++.h>

#define int long long
#define ld long double
#define F first
#define S second
using namespace std;
const int inf = 1e18;

struct line {
    int k;
    ld b;

    ld operator()(ld x) {
        return x / k + b;
    }

    ld inter(line a) {
        return (b - a.b) / (1.0 / (ld) a.k - 1.0 / (ld) k);
    }
};

bool cmp(line a, line b) {
    if (a.k == b.k) {
        return a.b < b.b;
    }
    return a.k > b.k;
}

int maxn;

int maxpow2(int x) {
    int y = 1;
    while (y < x) {
        y <<= 1;
    }
    return y;
}

vector<vector<line>> tr;
vector<vector<pair<ld, line>>> cht;

vector<pair<ld, line>> makecht(vector<line> ls) {
    vector<pair<ld, line>> ch;
    for (line i: ls) {
        while (!ch.empty()) {
            if (ch.back().S.k == i.k) {
                ch.pop_back();
                continue;
            }
            if (i(ch.back().F) > ch.back().S(ch.back().F)) {
                ch.pop_back();
            } else {
                break;
            }
        }
        if (ch.empty()) {
            ch.push_back({-inf, i});
        } else {
            ch.push_back({i.inter(ch.back().S), i});
        }
    }
    return ch;
}

ld getans(int l, int r, ld x) {
    l += maxn;
    r += maxn;
    ld mx = -inf;
    while (l < r) {
        if (l & 1) {
            int L = 0, R = cht[l].size();
            while (L + 1 < R) {
                int mid = (L + R) / 2;
                if (cht[l][mid].F <= x) {
                    L = mid;
                } else {
                    R = mid;
                }
            }
            mx = max(mx, cht[l][L].S(x));
            l++;
        }
        if (r & 1) {
            r--;
            int L = 0, R = cht[r].size();
            while (L + 1 < R) {
                int mid = (L + R) / 2;
                if (cht[r][mid].F <= x) {
                    L = mid;
                } else {
                    R = mid;
                }
            }
            mx = max(mx, cht[r][L].S(x));
        }
        l >>= 1;
        r >>= 1;
    }
    return mx;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m, T;
    cin >> n >> m >> T;
    maxn = maxpow2(n);
    tr.resize(maxn * 2);
    cht.resize(maxn * 2);
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> ids(m);
    for (int i = 0; i < m; ++i) {
        cin >> ids[i];
        ids[i]--;
    }
    vector<int> pref(n + 1);
    for (int i = 0; i < n; ++i) {
        pref[i + 1] = pref[i] + a[i];
    }
    for (int i = 0; i < n; ++i) {
        tr[i + maxn] = {{a[i], (ld) -pref[i + 1] / a[i] + i}};
        cht[i + maxn] = {{-inf, {a[i], (ld) -pref[i + 1] / a[i] + i}}};
    }
    for (int i = maxn - 1; i >= 1; --i) {
        tr[i].resize(tr[i * 2].size() + tr[i * 2 + 1].size());
        merge(tr[i * 2].begin(), tr[i * 2].end(), tr[i * 2 + 1].begin(), tr[i * 2 + 1].end(), tr[i].begin(), cmp);
        cht[i] = makecht(tr[i]);
    }
    int mx = 0;
    for (int i = 0; i < m; ++i) {
        int id = ids[i];
        int con = -id + 1;
        int x = T + pref[id];
        int l = id - 1, r = n;
        while (l + 1 < r) {
            int mid = (l + r) / 2;
            if (pref[mid + 1] - pref[id] <= T) {
                l = mid;
            } else {
                r = mid;
            }
        }
        mx = max(mx, ((int) floor(getans(id, r, x)) + con));
    }
    reverse(a.begin(), a.end());
    for (int i = 0; i < n; ++i) {
        pref[i + 1] = pref[i] + a[i];
    }
    tr.clear();
    cht.clear();
    tr.resize(maxn * 2);
    cht.resize(maxn * 2);
    for (int i = 0; i < n; ++i) {
        tr[i + maxn] = {{a[i], (ld) -pref[i + 1] / a[i] + i}};
        cht[i + maxn] = {{-inf, {a[i], (ld) -pref[i + 1] / a[i] + i}}};
    }
    for (int i = maxn - 1; i >= 1; --i) {
        tr[i].resize(tr[i * 2].size() + tr[i * 2 + 1].size());
        merge(tr[i * 2].begin(), tr[i * 2].end(), tr[i * 2 + 1].begin(), tr[i * 2 + 1].end(), tr[i].begin(), cmp);
        cht[i] = makecht(tr[i]);
    }
    for (int i = 0; i < m; ++i) {
        int id = n - ids[i] - 1;
        int con = -id + 1;
        int x = T + pref[id];
        int l = id - 1, r = n;
        while (l + 1 < r) {
            int mid = (l + r) / 2;
            if (pref[mid + 1] - pref[id] <= T) {
                l = mid;
            } else {
                r = mid;
            }
        }
        mx = max(mx, ((int) floor(getans(id, r, x)) + con));
    }
    cout << mx;
    return 0;
}
//не забудь сохранять коды!!!

