//#pragma GCC optimize("O3, Ofast, unroll-loops, inline, no-stack-protector")
#include <bits/stdc++.h>
//#pragma GCC target("avx2")

using namespace std;

using ll = long long;
using pii = pair<int, int>;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, T;
    cin >> n >> m >> T;
    vector<int> a(n), b(m);
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int j = 0; j < m; ++j) {
        cin >> b[j];
    }
    int ans = 0;
    for (int j = 0; j < m; ++j) {
        int el = b[j];
        int last = -1, next = n;
        if (j != 0) last = b[j - 1] - 1;
        if (j != m - 1) next = b[j + 1] - 1;
        int now = T;
        for (int i = el - 1; i > last; --i) {
            if (now < 0) break;
            ans = max(ans, (el - i - 1) + now / a[i]);
            now -= a[i];
        }
        now = T;
        for (int i = el - 1; i < next; ++i) {
            if (now < 0) break;
            ans = max(ans, (i - el + 1) + now / a[i]);
            now -= a[i];
        }
    }
    cout << ans;
}
