#include <bits/stdc++.h>
#include "ext/pb_ds/assoc_container.hpp"

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;

#define all(a) a.begin(), a.end()

using ordered_set = tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

void solve();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef _GLIBCXX_DEBUG
    freopen("input", "r", stdin);
#endif
    ll t = 1;
    //cin >> t;
    while (t--)
        solve();
}

void solve() {
    ll n, m, T;
    cin >> n >> m >> T;
    vector<ll> a(n), b;
    for (ll &i: a)
        cin >> i;
    while (m--) {
        ll x;
        cin >> x;
        b.push_back(x - 1);
    }
    ll ans = 0;
    for (ll i: b) {
        ans = max(ans, T / a[i]);
        ll t1 = T - a[i];
        for (ll j = i - 1; j >= 0; j--) {
            ans = max(ans, t1 / a[j] + i - j);
            t1 -= a[j];
        }
        t1 = T - a[i];
        for (ll j = i + 1; j < n; j++) {
            ans = max(ans, t1 / a[j] + i - j);
            t1 -= a[j];
        }
    }
    cout << ans << '\n';
}