//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;

/*

struct Update {
    long long add = 0;
    Update() : add(0) {}
    Update(long long add) : add(add) {}
    Update apply(Update other) {
        return add + other.add;
    }
};

struct Node {
    long long summ = 0, l = 0, r = 0;
    Node() : summ(0), l(0), r(0) {}
    Node(long long x) : summ(x) {}
    Node(long long x, long long l, long long r) : summ(x), l(l), r(r) {}
    Node merge(Node other) {
        return Node(summ + other.summ, l, other.r);
    }
    Node apply(Update other) {
        return Node(summ + other.add * (r - l), l, r);
    }
};

struct seg_tree {
    long long n;
    vector<long long> a;
    vector<Node> tree;
    vector<Update> updates;

    seg_tree(vector<long long> a2) {
        n = a2.size();
        a = a2;
        tree.resize(4 * n);
        updates.resize(4 * n);
        build(0, 0, n);
    }

    void push(long long v) {
        if (updates[v].add != 0) {
            updates[2 * v + 1] = updates[2 * v + 1].apply(updates[v]);
            updates[2 * v + 2] = updates[2 * v + 2].apply(updates[v]);
            tree[2 * v + 1] = tree[2 * v + 1].apply(updates[v]);
            tree[2 * v + 2] = tree[2 * v + 2].apply(updates[v]);
            updates[v] = 0;
        }
    }

    void build(long long v, long long l, long long r) {
        tree[v].l = l;
        tree[v].r = r;
        if (l == r - 1) {
            tree[v].summ = a[l];
            return;
        }
        long long mid = (l + r) / 2;
        build(2 * v + 1, l, mid);
        build(2 * v + 2, mid, r);
        tree[v] = tree[2 * v + 1].merge(tree[2 * v + 2]);
    }

    Node get(long long v, long long l, long long r, long long ql, long long qr) {
        //cout << v << endl;
        if (ql <= l && r <= qr) {
            //cout << "! " << v << endl;
            return tree[v];
        }
        if (qr <= l || r <= ql) {
            //cout << "? " << v << endl;
            return Node();
        }
        //cout << v << endl;
        push(v);
        //cout << v << endl;
        long long mid = (l + r) / 2;
        return get(2 * v + 1, l, mid, ql, qr).merge(get(2 * v + 2, mid, r, ql, qr));
    }


    Node get_q(long long l, long long r) {
        return get(0, 0, n, l, r);
    }


    void update(long long v, long long l, long long r, long long ql, long long qr, Update add) {
        //cout << "! " << v << " " << add.add << endl;
        if (ql <= l && r <= qr) {
            //cout << v << " " << add.add << endl;
            //cout << tree[v].summ << endl;
            tree[v] = tree[v].apply(add);
            //cout << tree[v].summ << " " << tree[v].r - tree[v].l << " " << add.add << endl;
            updates[v] = updates[v].apply(add);
            return;
        }
        if (qr <= l || r <= ql) {
            return;
        }
        push(v);
        long long mid = (l + r) / 2;
        update(2 * v + 1, l, mid, ql, qr, add);
        update(2 * v + 2, mid, r, ql, qr, add);
        tree[v] = tree[2 * v + 1].merge(tree[2 * v + 2]);
    }

    void update_q(long long l, long long r, long long add) {
        //cout << "! " << add << endl;
        update(0, 0, n, l, r, add);
    }
};

struct pt {
    long long x, y;
    pt() : x(0), y(0) {}
    pt(long long x, long long y) : x(x), y(y) {}
    pt(pt s, pt t) : x(t.x - s.x), y(t.y - s.y) {}

    long long operator*(pt other) {
        return x * other.y + y * other.x;
    }
    long long operator%(pt other) {
        return x * other.y - y * other.x;
    }

    pt operator*(long long k) {
        return pt(x * k, y * k);
    }

    pt operator+(pt other) {
        return pt(x + other.x, y + other.y);
    }

    pt operator-(pt other) {
        return pt(x - other.x, y - other.y);
    }
};

struct line {
    long long a, b, c;
    line() : a(0), b(0), c(0) {}
    line(pt s, pt t) {
        a = t.y - s.y;
        b = s.x - t.x;
        c = -(t.y * s.x - t.x * s.y);
        //(t.y - s.y) * t.x + (s.x - t.x) * t.y = -s.y * t.x + s.x * t.y
        //(t.y - s.y) * s.x + (s.x - t.x) * s.y = t.y * s.x - t.x * s.y
    }

    bool is_on_line(pt other) {
        return other.x * a + other.y * b + c == 0;
    }
};
*/



signed main() {
    //ios_base::sync_with_stdio(false);
    //cin.tie(nullptr);
    long long n, m, T;
    cin >> n >> m >> T;
    vector<long long> a(n);
    for (auto &i : a) {
        cin >> i;
    }
    vector<long long> pref(n + 1);
    for (long long i = 1; i <= n; i++) {
        pref[i] = pref[i - 1] + a[i - 1];
    }
    long long ans = 0;
    /*
    while (m--) {
        long long i;
        cin >> i;
        i--;
        ans = max(ans, T / a[i]);
        for (long long j = 0; j < i; j++) {
            if (pref[i + 1] - pref[j] <= T) {
                ans = max(ans, i - j + 1 + (T - (pref[i + 1] - pref[j])) / a[j]);
            }
        }
        for (long long j = i + 1; j < n; j++) {
            if (pref[j + 1] - pref[i] <= T) {
                ans = max(ans, j - i + 1 + (T - (pref[j + 1] - pref[i])) / a[j]);
            }
        }
    }*/
    vector<long long> b(m);
    for (auto &i : b) {
        cin >> i;
        i--;
    }
    sort(b.begin(), b.end());
    for (long long i = 0; i < n; i++) {
        /*
        long long nearest_right = lower_bound(b.begin(), b.end(), i) - b.begin();
        if (nearest_right != m) {
            nearest_right = b[nearest_right];
            if (i > nearest_right) {
                throw(0);
            }
            ans = max(ans, nearest_right - i + 1 + (T - (pref[nearest_right + 1] - pref[i])) / a[i]);
        }
        long long nearest_left = lower_bound(b.begin(), b.end(), i) - b.begin() - 1;
        if (nearest_left >= 0) {
            nearest_left = b[nearest_left];
            if (i < nearest_left) {
                throw(0);
            }
            ans = max(ans, i - nearest_left + 1 + (T - (pref[i + 1] - pref[nearest_left])) / a[i]);
        }*/
        for (long long j = 0; j < m; j++) {
            if (b[j] < i &&  (pref[i + 1] - pref[b[j]]) <= T) {
                ans = max(ans, i - b[j] + 1 + (T - (pref[i + 1] - pref[b[j]])) / a[i]);
            } else if (b[j] >= i && (pref[b[j] + 1] - pref[i]) <= T){
                ans = max(ans, b[j] - i + 1 + (T - (pref[b[j] + 1] - pref[i])) / a[i]);
            }
        }
    }
    cout << ans << endl;
}