//#pragma GCC optimize("O3,unroll-loops")
#include <vector>
//#pragma GCC target("avx2")
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define segl i*2+1, l, (r + l) / 2
#define segr i*2+2, (r + l) / 2, r

const long long MOD = 1e9 + 7;
const int maxn = 2e5 + 5;

template<typename T, typename K>
istream& operator>>(istream& a, pair<T, K>& b) {
    a >> b.first >> b.second;
    return a;
}

template<typename T>
istream& operator>>(istream& a, vector<T>& b) {
    for(auto&i : b)
        a >> i;
    return a;
}

template<typename T, typename K>
ostream& operator<<(ostream& a, pair<T, K>& b) {
    a << b.first << ' ' << b.second;
    return a;
}

template<typename T>
ostream& operator<<(ostream& a, vector<T>& b) {
    for(auto& i : b)
        a << i << ' ';
    return a;
}

/*
                               .
                              .#.
                             .z@z.
                            .z#@#z.
                           .z#@@@#z.
                          .z#@@@@@#z.
                            `^#@#^`
                              .@.
                              .@.
                            ._z@z_.
                        ._z@#^` `^#@z_.
                       @#^`         `^#@
                       @               @
                       @z_.         ._z@
                        `^#@z_.  ._z@#^`
                    ._z@#^` `^#@#^`  `^#@z_.
                ._z@#^`                    `^#@z_.
      ._z#z_. .@#^`                            `^#@.  ._z#z_.
    ._z###@@@#^`                                  `^#@@@@@###z_.
  ._z###@@@@@#^`                                  `^#@@@@@@###z_.
 ._z###@@@@@#^`                                    `^#@@@@@@@###z_.
.zz###@@###^^`                                      ``^^###@@@@@##zz..
 */

struct nd {
    int curpoint = 0;
    int nxpoint = 0;
};


void solve() {
    vector<nd> indU;
    int m, n, T;
    cin >> m >> n >> T;
    vector<int> dr(m), b(n);
    cin >> dr >> b;
    vector<int> ans(m);
    vector<int> sums(m + 1, 0);
    for(int i = 0; i<m; ++i) {
        sums[i + 1] += sums[i];
        sums[i + 1] += dr[i];
    }
    int curpoint = 0;
    for(int i = 0; i<m; ++i) {
        if(i == 0) {
            indU.push_back({i, -1});
            ans[i] = T / dr[i];
            continue;
        }
        if(dr[i - 1] > dr[i]) {
            while(!indU.empty() && dr[indU.back()] > dr[i]) {
                indU.pop_back();
            }
            if(indU.back().nxpoint == -1)
                indU.back().nxpoint = i;
            indU.push_back({i, -1});
        }
        for(int cp = curpoint; cp<indU.size(); ++cp) {
            if(indU[cp].nxpoint == -1) continue;
            if(sums[i + 1] - sums[indU[cp].nxpoint] > T)
                ++curpoint;
            else
                break;
        }
        for(int cp = curpoint; cp < indU.size(); ++cp) {
            if(sums[i + 1] - sums[indU[cp].curpoint] <= T) {
                ans[i] = max(ans[i], (T - (sums[i + 1] - sums[indU[cp].curpoint])) / dr[indU[cp].curpoint] + (i - indU[cp].curpoint + 1));
                continue;
            }
            int r = (indU[cp].nxpoint == -1) ? i + 1 : indU[cp].nxpoint;
            int l = indU[cp].curpoint - 1;
            while(r - l > 1) {
                int mg = (r + l) / 2;
                if((sums[i + 1] - sums[mg]) <= T) {
                    r = mg;
                } else {
                    l = mg;
                }
            }
            ans[i] = max(ans[i], (T - (sums[i + 1] - sums[r])) / dr[r] + (i - r + 1));
        }
    }
    int mx = 0;
    for(auto v : b) {
        mx = max(ans[v - 1], mx);
    }
    cout << mx << '\n';
}

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