//#define _GLIBCXX_DEBUG

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

using namespace std;
using ll = long long;
using ld = long double;

//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//template<typename T>
//using oset = tree<T, null_type, greater<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int ll

signed main() {
    int n, m, t;
    cin >> n >> m >> t;

    vector<int> a(n), pa(n + 1);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        pa[i + 1] = pa[i] + a[i];
    }

    vector<int> b(m);
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
        b[i]--;
    }

    int res = 0;
    for (int i = 0; i < n; ++i) {
        auto px = std::lower_bound(b.begin(), b.end(), i);

        if (px != b.end() and *px == i) {
            res = max(res, t / a[i]);
            continue;
        }

        if (px != b.end()) {
            if ((pa[*px + 1] - pa[i + 1]) < t)
                res = max(res, (t - (pa[*px + 1] - pa[i + 1])) / a[i] + (*px - i));
        }
        if (px != b.begin()) {
            px--;
            if ((pa[i] - pa[*px]) < t)
                res = max(res, (t - (pa[i] - pa[*px])) / a[i] + (i - *px));
        }
    }

    cout << res;
}
