#include <bits/stdc++.h>
using namespace std;
#define int long long
int n;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n;
    int m, tt;
    cin >> m >> tt;
    vector<int> a(n);
    for (auto &v : a)
        cin >> v;
    vector<int> b(m);
    for (auto &v : b)
        cin >> v;
    vector<long long> p(n + 1);
    partial_sum(a.begin(), a.end(), p.begin() + 1);
    vector<long long> ans(n);
    for (int i = 0; i < n; i++) {
        ans[i] = tt / a[i];
        for (int j = i - 1; j >= 0 &&  tt >= p[i + 1] - p[j + 1]; j--)
            ans[i] = max(ans[i], i - j + (tt - (p[i + 1] - p[j + 1])) / a[j]);
        for (int j = i + 1; j < n &&  tt >= p[j] - p[i]; j++)
            ans[i] = max(ans[i], j - i + (tt - (p[j] - p[i])) / a[j]);
    }
    long long rl = -1;
    for (auto &v : b)
        rl = max(rl, ans[v - 1]);
    cout << rl << "\n";
    return 0;
}