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

using namespace std;
//using namespace __gnu_pbds;

//template<typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define rs resize
#define pb push_back
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define int long long

typedef long double ld;
typedef long long ll;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template<typename T>
istream &operator >>(istream &in, pair<T, T> &a) {
    in >> a.ff >> a.ss;
    return in;
}

template<typename T>
ostream &operator <<(ostream &out, pair<T, T> &a) {
    out << a.ff << " " << a.ss;
    return out;
}

template<typename T>
istream &operator >>(istream &in, vector<T> &a) {
    for (auto &i : a) in >> i;
    return in;
}

template<typename T>
ostream &operator <<(ostream &out, vector<T> &a) {
    for (auto i : a) cout << i << " ";
    return out;
}

const int maxn =3e5 + 10;

int n, m, t;
int a[maxn], b[maxn], prf[maxn];

int dst(int l, int r) {
    return prf[r] - prf[l - 1];
}

int check(int md) {
    int l = 1;
    for (int i = 1; i <= m; i++) {
        while (l <= b[i]) {
            if (dst(l + 1, b[i]) <= t && (t - dst(l + 1, b[i])) / a[l] + (b[i] - l) >= md) return 1;
            l++;
        }
    }

    int r = n;
    for (int i = m; i > 0; i--) {
        while (b[i] <= r) {
            //cout << dst(b[i], r) << " " << (t - dst(b[i], r)) / a[r] << " " << (r - b[i]) << "\n";
            if (dst(b[i], r - 1) <= t && (t - dst(b[i], r - 1)) / a[r] + (r - b[i]) >= md) return 1;
            r--;
        }
    }
    return 0;
}

void solve() {
    cin >> n >> m >> t;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        prf[i] = prf[i - 1] + a[i];
    }
    for (int i = 1; i <= m; i++) cin >> b[i];

    int l = 0, r = 10;
    while (r - l > 1) {
        int md = (l + r) / 2;

        if (check(md)) l = md;
        else r = md;
    }

    cout << l << "\n";
}

int32_t main() {
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#endif
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    double tim = clock();
#endif

    int tests = 1;
    //cin >> tests;
    while (tests--) {
        solve();
#ifdef LOCAL
        cout << "-------------------\n";
#endif
    }

#ifdef LOCAL
    cout << (double)(clock() - tim) / CLOCKS_PER_SEC;
#endif
}
