#include <bits/stdc++.h>
#include "ext/pb_ds/assoc_container.hpp"

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;

#define all(a) a.begin(), a.end()

using ordered_set = tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

void solve();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef _GLIBCXX_DEBUG
    freopen("input", "r", stdin);
#endif
    ll t = 1;
    //cin >> t;
    while (t--)
        solve();
}

struct line {
    ll a = 0, t = -1e9, x = -1e9;

    line() = default;

    line(ll a, ll t, ll x) : a(a), t(t), x(x) {}

    ll get(ld p) {
        if (a == 0)
            return -1e18;
        if (p > t)
            return -1e18 + 1;
        return (t - p) / a + x;
    }
};

map<ll, line> Tr;

void add(line x, ll l, ll r, ll ndx) {
    ll m = (r + l) / 2;
    if (Tr[ndx].get(m) < x.get(m))
        swap(Tr[ndx], x);
    if (l + 1 > r)
        return;
    if (Tr[ndx].get(m) < x.get(l))
        add(x, l, m, ndx * 2 + 1);
    if (Tr[ndx].get(m) < x.get(r))
        add(x, m + 1, r, ndx * 2 + 2);
}

ll get(ll x, ll l, ll r, ll ndx) {
    if (Tr.find(ndx) == Tr.end())
        return -1e18;
    ll m = (r + l) / 2;
    if (m >= x)
        return max(Tr[ndx].get(x), get(x, l, m, ndx * 2 + 1));
    return max(Tr[ndx].get(x), get(x, m + 1, r, ndx * 2 + 2));
}

ll get(ll n, ll m, ll T, vector<ll> &a, vector<ll> &b) {
    ll ans = 0;
    ll pr = 0;
    Tr.clear();
    for (ll i = 0; i < n; i++) {
        pr += a[i];
        if (b[i]) {
            ans = max(ans, T / a[i]);
            ans = max(ans, get(pr, 0, 1e13, 0) + i);
        }
        add({a[i], pr + T, -i}, 0, 1e13, 0);
    }
    return ans;
}

void solve() {
    ll n, m, T;
    cin >> n >> m >> T;
    vector<ll> a(n), b(n);
    for (ll &i: a)
        cin >> i;
    while (m--) {
        ll x;
        cin >> x;
        b[x - 1] = 1;
    }
    ll ans = get(n, m, T, a, b);
    reverse(all(a));
    reverse(all(b));
    cout << max(ans, get(n, m, T, a, b)) << '\n';
}