#include <iostream>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <math.h>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static const int inf = 1e15;
static const ld eps = 1e-7;

void solve() {
    int n, m, T;
    cin >> n >> m >> T;
    vector<int> a(n + 1);
    vector<int> ps(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        ps[i] = ps[i - 1] + a[i];
    }
    vector<int> b(m);
    for (auto &c : b) {
        cin >> c;
    }
    int j = 0;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        while (j != m - 1 && b[j + 1] <= i) {
            j++;
        }
        if (i == b[j]) {
            ans = max(ans, T / a[i]);
        } else {
            int qwe = ps[i - 1] - ps[b[j] - 1];
            if (qwe > 0) {
                ans = max(ans, (i - b[j]) + (T - qwe) / a[i]);
            }
            if (j != m - 1) {
                qwe = ps[b[j + 1]] - ps[i];
                if (qwe > 0) {
                    ans = max(ans, (b[j + 1] - i) + (T - qwe) / a[i]);
                }
            }
        }
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int tt = 1;
    // cin >> tt;
    while (tt--) {
        solve();
    }
    return 0;
}
