#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <tuple>
#include <queue>
#include <cmath>

using namespace std;
using ll = long long;

constexpr int INF = 1e9 + 7;
constexpr ll LINF = 1e18 + 7;

struct SegmentTree {
    struct node {
        ll mx = 0;
        ll p = 0;
    };
    vector<node>tree;

    inline int L(int v) { return 2 * v + 1; }
    inline int R(int v) { return 2 * v + 2; }


    void push(int v, int l, int r) {
        int mid = (l + r) / 2;
        tree[L(v)].mx += tree[v].p;
        tree[L(v)].p += tree[v].p;
        tree[R(v)].mx += tree[v].p;
        tree[R(v)].p += tree[v].p;
        tree[v].p = 0;
    }

    void add(int ql, int qr, ll x, int l, int r, int v) {
        if (l >= qr || r <= ql) return;
        if (ql <= l && r <= qr) {
            tree[v].mx += x;
            tree[v].p += x;
            return;
        }
        int mid = (l + r) / 2;
        push(v, l, r);
        add(ql, qr, x, l, mid, L(v));
        add(ql, qr, x, mid, r, R(v));
        tree[v].mx = max(tree[L(v)].mx, tree[R(v)].mx);
    }

    int getmax(int ql, int qr, int l, int r, int v) {
        if (l >= qr || r <= ql) return 0;
        if (ql <= l && r <= qr) return tree[v].mx;
        int mid = (l + r) / 2;
        push(v, l, r);
        return max(getmax(ql, qr, l, mid, L(v)), getmax(ql, qr, mid, r, R(v)));
    }

    void build(vector<int>& a, int l, int r, int v) {
        if (r - l == 1) {
            tree[v].mx = a[l];
            return;
        }
        int mid = (l + r) / 2;
        build(a, l, mid, L(v));
        build(a, mid, r, R(v));
        tree[v].mx = max(tree[L(v)].mx, tree[R(v)].mx);
    }

    SegmentTree() {
        tree = {};
    }
    SegmentTree(int n) {
        tree.resize(4 * n);
    }
    SegmentTree(vector<int>a) {
        int n = a.size();
        tree.resize(4 * n);
        build(a, 0, n, 0);
    }
};

SegmentTree Tree;

vector<vector<int>>g;
vector<vector<int>>grev;

vector<int>topsort;
vector<bool>used;
void dfs_topsort(int v) {
    used[v] = 1;
    for (int u : g[v]){
        if (!used[u]) dfs_topsort(u);
    }
    topsort.push_back(v);
}

vector<int>color;
void dfs_color(int v, int col) {
    cout << v << ' ' << col << "\n";
    color[v] = col;
    for (int u : grev[v]) {
        if (color[u] == -1) {
            dfs_color(u, col);
        }
    }
}

vector<vector<int>>g1;
vector<int>h;
int ans = 0;
int dfs_path(int v, int hh) {
    h[v] = hh;
    used[v] = 1;
    for (int u : g[v]) {
        if (used[u] == 2) continue;
        if (used[u] == 1) return u;
        int w = dfs_path(u, hh + 1);
        if (w != -1) {
            ans -= h[w] - h[v];
        }
    }
    return -1;
}

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];
    }
    vector<ll>prefsum(n + 1);
    for (int i = 0; i < n; ++i) {
        prefsum[i + 1] = prefsum[i] + a[i];
    }
    vector<ll>ans(m);
    ll res = 0;
    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < n; ++j) {
            ll time = 0;
            if (j < b[i]) time = prefsum[b[i] + 1] - prefsum[j + 1];
            else time = prefsum[j] - prefsum[b[i]];
            if (time > T) continue;
            ans[i] = max(ans[i], abs(b[i] - j) + (T - time) / a[j]);
        }
        res = max(res, ans[i]);
    }
    cout << res << "\n";
   
}
