#ifndef LOCAL
  #pragma GCC optimize("Ofast,unroll-loops")
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#ifndef LOCAL
  #pragma GCC target("avx,avx2,fma")
#endif

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define all(x) begin(x), end(x)
#define isz(x) (int)size(x)

int n, T;

vector<int> Calc(const vector<int>& a) {
  vector<ll> p(n + 1);
  for (int i = 0; i < n; ++i) {
    p[i + 1] = p[i] + a[i];
  }
  gp_hash_table<int, int> pos;
  pos[a[0]] = 0;
  vector<int> cnt(n);
  for (int i = 0; i < n; ++i) {
    pos[a[i]] = i;
    if (i && a[i] < a[i - 1]) pos[a[i]] = i;
    for (auto [val, j] : pos) {
      cnt[i] = max<ll>(cnt[i], i - j + (T - (p[i + 1] - p[j + 1])) / val);
    }
  }
  return cnt;
}

void solve() {
  int m;
  cin >> n >> m >> T;
  vector<int> a(n);
  for (auto& it : a) {
    cin >> it;
  }
  vector<int> b(m);
  for (auto& it : b) {
    cin >> it;
  }
  auto c1 = Calc(vector<int>(a.begin(), a.end()));
  auto c2 = Calc(vector<int>(a.rbegin(), a.rend()));
  reverse(all(c2));
  vector<int> cnt(n);
  for (int i = 0; i < n; ++i) cnt[i] = max(c1[i], c2[i]);
  int ans = 0;
  for (auto it : b) {
    ans = max(ans, cnt[it - 1]);
  }
  cout << ans << '\n';
}

signed main() {
  cin.tie(0)->sync_with_stdio(0);
  int t = 1;
  // cin >> t;
  for (int i = 0; i < t; ++i) {
    solve();
  }
}