#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>

using namespace std;

#define ll long long

const ll maxn = 1e6;
pair<ll, ll> t1[4 * maxn];
vector<ll> a;

void build1(ll v, ll l, ll r) {
    if (l == r - 1) {
        t1[v] = {a[l], l};
        return;
    }
    ll m = (l + r) / 2;
    build1(2 * v + 1, l, m);
    build1(2 * v + 2, m, r);
    t1[v] = min(t1[2 * v + 1], t1[2 * v + 2]);
}

pair<ll, ll> min1(ll v, ll l, ll r, ll l1, ll r1) {
    if (l >= r1 || r <= l1) {
        return {1e18, 1e18};
    }
    if (l >= l1 && r <= r1) {
        return t1[v];
    }
    ll m = (l + r) / 2;
    pair<ll, ll> p1 = min1(2 * v + 1, l, m, l1, r1);
    pair<ll, ll> p2 = min1(2 * v + 2, m, r, l1, r1);
    return min(p1, p2);
}

pair<ll, ll> t2[4 * maxn];

void build2(ll v, ll l, ll r) {
    if (l == r - 1) {
        t2[v] = {a[l], l};
        return;
    }
    ll m = (l + r) / 2;
    build2(2 * v + 1, l, m);
    build2(2 * v + 2, m, r);
    if (t2[2 * v + 1].first != t2[2 * v + 2].first) {
        t2[v] = min(t2[2 * v + 1], t2[2 * v + 2]);
    } else {
        t2[v].first = t2[2 * v + 1].first;
        t2[v].second = max(t2[2 * v + 1].second, t2[2 * v + 2].second);
    }
}

pair<ll, ll> min2(ll v, ll l, ll r, ll l1, ll r1) {
    if (l >= r1 || r <= l1) {
        return {1e18, 1e18};
    }
    if (l >= l1 && r <= r1) {
        return t2[v];
    }
    ll m = (l + r) / 2;
    pair<ll, ll> p1 = min2(2 * v + 1, l, m, l1, r1);
    pair<ll, ll> p2 = min2(2 * v + 2, m, r, l1, r1);
    if (p1.first != p2.first) {
        return min(p1, p2);
    }
    pair<ll, ll> answer;
    answer.first = p1.first;
    answer.second = max(p1.second, p2.second);
    return answer;
}

vector<ll> pref;

ll sum(ll l, ll r) {
    if (l > r) {
        return 0;
    }
    if (l == 0) {
        return pref[r];
    }
    return pref[r] - pref[l - 1];
}

ll f(ll ind1, ll ind2, ll t) {
    if (ind1 == ind2) {
        return t / a[ind1];
    }
    if (ind1 < ind2) {
        ll answer = ind2 - ind1;
        ll sum1 = t - sum(ind1 + 1, ind2);
        if (sum1 < 0) {
            return 0;
        }
        answer += sum1 / a[ind1];
        return answer;
    } else {
        ll answer = ind1 - ind2;
        ll sum1 = t - sum(ind2, ind1 - 1);
        if (sum1 < 0) {
            return 0;
        }
        answer += sum1 / a[ind1];
        return answer;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, m, t;
    cin >> n >> m >> t;
    a.resize(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
    }
    build1(0, 0, n);
    build2(0, 0, n);
    vector<ll> b(m);
    for (ll i = 0; i < m; i++) {
        cin >> b[i];
        b[i]--;
    }
    pref.resize(n);
    pref[0] = a[0];
    for (ll i = 1; i < n; i++) {
        pref[i] = pref[i - 1] + a[i];
    }
    ll answer = 0;
    for (ll i = 0; i < m; i++) {
        if (a[b[i]] > t) {
            continue;
        }
        answer = max(answer, t / a[b[i]]);
        ll l1 = 0;
        ll r1 = b[i];
        while (r1 - l1 > 2) {
            ll m1 = l1 + (r1 - l1) / 2;
            ll m2 = r1 - (r1 - l1) / 2;
            pair<ll, ll> p1 = min2(0, 0, n, m1, b[i] + 1);
            pair<ll, ll> p2 = min2(0, 0, n, m2, b[i] + 1);
            if (f(p1.second, b[i], t) < f(p2.second, b[i], t)) {
                l1 = m1;
            } else {
                r1 = m2;
            }
        }
        for (ll i1 = -500; i1 <= 500; i1++) {
            if (l1 + i1 >= 0 && l1 + i1 < n) {
                answer = max(answer, f(l1 + i1, b[i], t));
            }
        }
        l1 = b[i];
        r1 = n - 1;
        while (r1 - l1 > 2) {
            ll m1 = l1 + (r1 - l1) / 2;
            ll m2 = r1 - (r1 - l1) / 2;
            pair<ll, ll> p1 = min1(0, 0, n, b[i], m1 + 1);
            pair<ll, ll> p2 = min1(0, 0, n, b[i], m2 + 1);
            if (f(p1.second, b[i], t) < f(p2.second, b[i], t)) {
                l1 = m1;
            } else {
                r1 = m2;
            }
        }
        for (ll i1 = -500; i1 <= 500; i1++) {
            if (l1 + i1 >= 0 && l1 + i1 < n) {
                answer = max(answer, f(l1 + i1, b[i], t));
            }
        }
    }
    cout << answer;
}