#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pp = pair<int, int>;
using ld = long double;

template <typename T>
istream &operator>>(istream &s, vector<T> &a)
{
    for (T &el : a)
    {
        s >> el;
    }
    return s;
}

template <typename T>
ostream &operator<<(ostream &s, vector<T> &a)
{
    for (T el : a)
    {
        s << el << ' ';
    }
    s << '\n';
    return s;
}

void solve()
{
    ll n, m, T;
    cin >> n >> m >> T;
    vector<ll> arr(n);
    cin >> arr;
    vector<ll> good(m);
    cin >> good;
    for (ll &el : good)
    {
        el--;
    }
    vector<ll> pref(n);
    pref[0] = arr[0];
    for (ll i = 1; i < n; i++)
    {
        pref[i] = pref[i - 1] + arr[i];
    }
    ll ans = 0;
    for (ll i = 0; i < n; i++)
    {
        auto it = lower_bound(good.begin(), good.end(), i);
        if (it != good.end())
        {
            // forward
            ll dist = pref[*it] - pref[i];
            if (dist <= T)
            {
                ans = max(ans, *it - i + (T - dist) / arr[i]);
            }
        }
        if (it != good.begin())
        {
            it = prev(it);
            // backward
            ll dist = (pref[i] - arr[i]) - (*it == 0 ? 0 : pref[*it - 1]);
            if (dist <= T)
            {
                ans = max(ans, i - *it + (T - dist) / arr[i]);
            }
        }
    }
    cout << ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
}