#pragma GCC optimize("03")
#include <iostream>
#include <set>
#include <vector>
#include <random>
#include <iomanip>
//#include <fstream>
#include <algorithm>
#include <map>
#include <unordered_set>
#include <unordered_map>
#pragma GCC target("avx2")
const int INF = 1e7;
const int N = 3e5 + 1;
using namespace std;
int get(vector<int>& a, int i, int l, int r, int T) {
    int ans = 0;
    int ost = T;
    int cur = 0;
    for (int j = i; j <= r; j++) {
        ost -= a[j];
        cur++;
        if (ost < 0) continue;
        ans = max(ans, cur + ost / a[j]);
    }
    ost = T;
    cur = 0;
    for (int j = i; j >= l; j--) {
        ost -= a[j];
        cur++;
        if (cur < 0) continue;
        ans = max(ans, cur + ost / a[j]);
    }
    return ans;
}
signed main()
{
    cin.tie(nullptr)->sync_with_stdio(false);
    int n, m, t;
    cin >> n >> m >> t;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<int> b(m);
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        b[i]--;
    }
    int ans = 0;

    for (int i = 0; i < m; i++) {
        int l = 0, r = n - 1;
        if (i != 0) l = b[i - 1];
        if (i != m - 1) r = b[i + 1];
        ans = max(ans, get(a, b[i], l, r, t));
    }
    cout << ans << '\n';

}