#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <unordered_map>
#include <random>

#define all(v) v.begin(), v.end()
#define len(v) (int)v.size()
#define coutd cout << fixed << setprecision(20)

using namespace std;
using ll = long long;
using ld = long double;


int main()
{
    cin.tie(0)->sync_with_stdio(0);
    int n, m;
    ll T;
    cin >> n >> m >> T;
    vector<ll> 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];
    }
    ll cur = 0;
    ll ans = 0;
    int i = b[0];
    while (true)
    {
        if (cur + a[i] <= T)
        {
            cur += a[i];
            --i;
            ++ans;
            if (i == -1) break;
        } else
        {
            break;
        }
    }
    ans += (T / a[0]);
    cout << ans;

    return 0;
}
