#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#define int long long

// #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 max_roads[MAXN];

struct Sparce_table {
    int n;
    vector <int> my_log;
    vector <vector <pair <int, int>>> table;
    Sparce_table(vector <int>& a) {
        n = sz(a);
        my_log.assign(n + 1, 0);
        for (int i = 2; i <= n; i++) {
            my_log[i] = my_log[i / 2] + 1;
        }
        table.assign(my_log[n] + 1, vector <pair <int, int>> (n));
        for (int i = 0; i < n; i++) {
            table[0][i] = {a[i], i};
        }
        for (int i = 1; i <= my_log[n]; i++) {
            for (int j = 0; j + (1 << i) <= n; j++) {
                table[i][j] = min(table[i - 1][j], table[i - 1][j + (1 << (i - 1))]);
            }
        }
    }
    int get(int l, int r) {
        int degree = my_log[r - l];
        return min(table[degree][l], table[degree][r - (1 << degree)]).second;
    }
};

int count_roads(int start, int farthest_end, ll t, vector <int>& roads, vector <ll>& pref_sums, Sparce_table& table) {
    int end = table.get(start, farthest_end);
    if (t < pref_sums[farthest_end] - pref_sums[start]) {
        return 0;
    }
    return end - start + (t - (pref_sums[farthest_end] - pref_sums[start])) / roads[end];
}

void solve(int n, int m, ll t, vector <int>& a, vector <int>& b) {
    vector <ll> pref_sums(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        pref_sums[i] = pref_sums[i - 1] + a[i - 1];
    }
    Sparce_table table(a);
    for (int i = 0; i < m; i++) {
        int l = b[i], r = n - 1, x1, x2, y1, y2;
        while (r - l > 2) {
            x1 = (2 * l + r) / 3;
            x2 = (l + 2 * r) / 3;
            y1 = count_roads(b[i], x1, t, a, pref_sums, table);
            y2 = count_roads(b[i], x2, t, a, pref_sums, table);
            if (y1 < y2) {
                l = x1;
            } else {
                r = x2;
            }
        }
        max_roads[i] = max({max_roads[i],
                            count_roads(b[i], l, t, a, pref_sums, table),
                            count_roads(b[i], l + 1, t, a, pref_sums, table),
                            count_roads(b[i], r, t, a, pref_sums, table)});
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, t;
    cin >> n >> m >> t;
    vector <int> a(n), b(m);
    for (auto& i : a) {
        cin >> i;
    }
    for (auto& j : b) {
        cin >> j; j--;
    }
    solve(n, m, t, a, b);
    reverse(a.begin(), a.end());
    for (auto& i : b) {
        i = n - 1 - i;
    }
    solve(n, m, t, a, b);
    cout << *max_element(max_roads, max_roads + m);
    return 0;
}
