#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi2")

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <typename T>
using ordered_set = __gnu_pbds::tree <T, __gnu_pbds::null_type, less <T>,
        __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

template <typename T>
int sz(const T &x) {
    return static_cast <int> (x.size());
}

mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int MAXN = 3e5;
const int INF = 2e9;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-8;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n, m, t;
    cin >> n >> m >> t;
    vector <ll> a(n), b(m), pref_sums(n + 1, 0);
    for (auto& i : a) {
        cin >> i;
    }
    for (auto& i : b) {
        cin >> i; i--;
    }
    for (ll i = 1; i <= n; i++) {
        pref_sums[i] = pref_sums[i - 1] + a[i - 1];
    }
    ll ans = 0;
    for (ll i = 0; i < n; i++) {
        ll runner = upper_bound(b.begin(), b.end(), i) - b.begin();
        if (runner) {
            runner--;
            ans = max(ans, i - b[runner] + (t - (pref_sums[i] - pref_sums[b[runner]])) / a[i]);
        }
        runner = lower_bound(b.begin(), b.end(), i) - b.begin();
        if (runner < m) {
            ans = max(ans, b[runner] - i + (t - (pref_sums[b[runner] + 1] - pref_sums[i + 1])) / a[i]);
        }
    }
    cout << ans;
    return 0;
}
