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

#ifndef DEBUG
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
#endif

using namespace __gnu_pbds;

template<typename T>
using oset = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = long long;
using pll = std::pair<ll, ll>;
using ld = long double;
using i128 = __int128;

#define lv(v) v + 1
#define rv(v) v + 2 * (m - l)

std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());

void solve() {
    ll n, m, T;
    std::cin >> n >> m >> T;
    std::vector<ll> a(n), b(m);
    std::vector<ll> pref(n + 1);
    for (int i = 0; i < n; ++i) {
        std::cin >> a[i];
        pref[i + 1] = pref[i] + a[i];
    }
    for (int i = 0; i < m; ++i) {
        std::cin >> b[i];
        --b[i];
    }
    ll opt = 0;
    std::vector<ll> ans(n);
    for (int i = 0; i < n; ++i) {
        auto itt = std::lower_bound(b.begin(), b.end(), i);
        if (itt != b.end()) {
            ll it = *itt;
            if (i == it) {
                ans[i] = std::max(ans[i], T / a[i]);
                continue;
            }
            ans[i] = std::max(ans[i], it - i + (T - pref[it + 1] + pref[i + 1]) / a[i]);
        }
        itt = std::upper_bound(b.begin(), b.end(), i);
        if (itt != b.begin()) {
            --itt;
            ll it = *itt;
            ll dx = T - pref[i] + pref[it];
            ans[i] = std::max(ans[i], i - it + (dx) / a[i]);
        }
    }
    std::cout << *std::max_element(ans.begin(), ans.end());
}

int main() {
#ifdef DEBUG
    std::freopen("/home/olymp/CLionProjects/untitled/input.txt", "r", stdin);
#endif
    std::cin.tie(0)->std::ios::sync_with_stdio(0);
    int tt = 1;
//    std::cin >> tt;
    while (tt--) {
        solve();
    }
}
