
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define ve vector
#define pb push_back
#define all(a) a.begin(), a.end()
#define first f
#define second s
using ld = long double;
#define int ll
mt19937 rnd(321932);

template<class A>
istream &operator>>(istream &in, ve<A> &a) {
    for (auto &x: a)
        in >> x;
    return in;
}

template<class A>
ostream &operator<<(ostream &out, ve<A> a) {
    for (auto &x: a)
        out << x << ' ';
    return out << '\n';
}
ve<int> x;
struct lct {
    int n;
    struct func {
        ld a, b;
        int get(int i) {
            return (int)(a * x[i] + b);
        }
    };
    ve<func> t;
    void add(int v, int l, int r, func nw) {
        int m = (l + r)/2;
        auto &old = t[v];
        if (old.get(m) < nw.get(m))
            swap(old, nw);
        if (l + 1 == r)
            return;
        if (nw.get(l) >= old.get(l))
            add(2*v+1, l, m, nw);
        else if (nw.get(r-1) >= old.get(r-1))
            add(2*v+2, m, r, nw);
    }

    void add(ld a, ld b) {
        add(0, 0, n, {a, b});
    }

    int get(int v, int l, int r, int i) {
        if (l + 1 == r)
            return t[v].get(i);
        int m = (l + r)/2;
        if (i < m)
            return max(t[v].get(i), get(2*v+1, l, m, i));
        else
            return max(t[v].get(i), get(2*v+2, m, r, i));
    }

    int get(int i) {
        return (int)get(0, 0, n, i);
    }

    lct() {
        n = x.size();
        t.assign(4*n, {0, -1e18});
    }
};

int32_t main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m, T;
    cin >> n >> m >> T;
    ve<int> a(n), b(m);
    cin >> a >> b;
    x.assign(n + 1, 0);
    for (int i = 0;  i< n; ++i)
        x[i+1] = x[i] + a[i];
    int k = (int)b.size() - 1;
    ve<int> ans(m, 0);
    lct t;
    for (int i = n - 1; i >= 0; --i) {
        t.add(1/ld(a[i]), i + (T - x[i])/ld(a[i]));
        if (k >= 0 && b[k] == i + 1) {
            ans[k] = max(ans[k], t.get(i) - i);
            k--;
        }
    }
    // cout << ans;
    t = lct();
    k = 0;
    for (int i = 0; i < n; ++i) {
        t.add(-1/ld(a[i]), -i + (T+x[i+1])/ld(a[i]));
        if (k < m && b[k] == i + 1) {
            ans[k] = max(ans[k], t.get(i+1) + i);
            k++;
        }
    }
    // cout << ans;
    cout << *max_element(all(ans));
}
