#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
using namespace std;
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

mt19937_64 rnd(1488);


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m, t;
    cin >> n >> m >> t;
    vector<bool> A(m);
    vector<int> L(n), P(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        cin >> L[i];
        P[i + 1] = P[i] + L[i];
    }
    for (int i = 0; i < m; ++i) {
        int cr;
        cin >> cr;
        --cr;
        A[cr] = 1;
    }
    int ans = 0;
    int f = -1;
    for (int i = 0; i < n; ++i) {
        if (A[i]) {
            f = i;
        }
        if (f == -1) {
            continue;
        }
        int sum = P[i] - P[f], cnt = i - f;
        if (t < sum) {
            continue;
        }
        ans = max(ans, (t - sum) / L[i] + cnt);
    }
    f = n;
    for (int i = n - 1; i >= 0; --i) {
        if (A[i]) {
            f = i;
        }
        if (f == n) {
            continue;
        }
        int sum = P[f + 1] - P[i + 1], cnt = f - i;
        if (t < sum) {
            continue;
        }
        ans = max(ans, (t - sum) / L[i] + cnt);
    }
    cout << ans;
}

