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

//template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//struct Node {
//    int sum;
//    Node (int sum): sum(sum) {}
//    Node () {}
//};
//
//struct Segment_tree {
//    int n;
//    vector<Node> t;
//
//    //void insert
//};
//
//int N = 1000000;
//int lg = 19;
//
//
//vector<vector<int>> gr;
//vector<int> sz;
//
//void dfs(int cur, int p) {
//    for (auto i: gr[cur]) {
//        if (sz[i] == -1) {
//            sz[i] = sz[cur] + 1;
//            dfs(i, cur);
//        }
//    }
//
//}

signed main() {
    int n, m, T;
    cin >> n >> m >> T;
    vector<int> vec(n);
    for (auto &i: vec) cin >> i;
    vector<int> beg(n, 0);
    for (int i = 0; i < m ;i++) {
        int a;
        cin >> a;
        beg[a - 1] = 1;
    }
    vector<int> maxs(n, 0);
    int pred = -1;
    vector<int> pref(n + 1);
    pref[0] = 0;
    for (int i = 0; i < n; i++) {
        if (beg[i]) {
            pred = i;
        }
        if (pred != -1) {
            int sm = pref[i] - pref[pred];
            if (sm + vec[i] <= T) {
                   maxs[i] = max(maxs[i], i - pred + (T - sm) / vec[i]);
            }
        }
        pref[i + 1] = pref[i] + vec[i];
    }

    int next = -1;
    vector<int> suf(n + 1);
    suf[n] = 0;
    for (int i = n - 1; i >= 0; i--) {
        if (beg[i]) {
            next = i;
        }
        if (next != -1) {
            int sm = suf[i + 1] - suf[next + 1];
            if (sm + vec[i] <= T) {
                maxs[i] = max(maxs[i], next - i + (T - sm) / vec[i]);
            }
        }
        suf[i] = suf[i + 1] + vec[i];
    }
    int ans = 0;
    for (auto i: maxs) ans = max(ans, i);
    cout << ans;
}
