#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];
    }
    vector<ll> ind1(n, -1);
    stack<pair<ll, ll>> s1;
    for (ll i = 0; i < n; i++) {
        if (s1.empty()) {
            s1.push({a[i], i});
        } else {
            while (!s1.empty() && s1.top().first >= a[i]) {
                s1.pop();
            }
            if (!s1.empty()) {
                ind1[i] = s1.top().second;
            }
            s1.push({a[i], i});
        }
    }
    vector<ll> ind2(n, n);
    stack<pair<ll, ll>> s2;
    for (ll i = n - 1; i >= 0; i--) {
        if (s2.empty()) {
            s2.push({a[i], i});
        } else {
            while (!s2.empty() && s2.top().first >= a[i]) {
                s2.pop();
            }
            if (!s2.empty()) {
                ind2[i] = s2.top().second;
            }
            s2.push({a[i], 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 = -1;
        ll r1 = b[i];
        while (r1 - l1 > 1) {
            ll m1 = (l1 + r1) / 2;
            if (sum(m1, b[i]) <= t) {
                r1 = m1;
            } else {
                l1 = m1;
            }
        }
        ll answer1 = 0;
        pair<ll, ll> p1 = min2(0, 0, n, r1, b[i] + 1);
        ll sum1 = t - sum(p1.second + 1, b[i]);
        answer1 += b[i] - p1.second;
        answer1 += sum1 / a[p1.second];
        answer = max(answer, answer1);
        l1 = b[i];
        r1 = n;
        while (r1 - l1 > 1) {
            ll m1 = (l1 + r1) / 2;
            if (sum(b[i], m1) <= t) {
                l1 = m1;
            } else {
                r1 = m1;
            }
        }
        pair<ll, ll> p2 = min1(0, 0, n, b[i], l1 + 1);
        ll answer2 = p2.second - b[i];
        ll sum2 = t - sum(b[i], p2.second - 1);
        answer2 += sum2 / a[p2.second];
        answer = max(answer, answer2);
        if (ind1[i] != -1) {
            answer = max(answer, f(ind1[i], b[i], t));
        }
        if (ind2[i] != n) {
            answer = max(answer, f(ind2[i], b[i], t));
        }
    }
    cout << answer;
}