def f(preff, n, x, i, ii, t):
    if i <= ii:
        ss = preff[ii + 1] - preff[i]
        if ss > t:
            return 0
        return (t - ss) // x + ii - i + 1
    ss = preff[i + 1] - preff[ii]
    if ss > t:
        return 0
    return (t - ss) // x + i - ii + 1


n, m, t = map(int, input().split())
a = list(map(int, input().split()))
b = [i - 1 for i in list(map(int, input().split()))]
preff = [0 for _ in range(n + 1)]
for i in range(n):
    preff[i + 1] = preff[i] + a[i]
ii = 0
ans = 0
for i in range(n):
    ans = max(ans, f(preff, n, a[i], i, b[ii], t))
    if ii != m - 1:
        ans = max(ans, f(preff, n, a[i], i, b[ii + 1], t))
    if ii != m - 1 and b[ii] <= i + 1:
        ii += 1
print(ans)