n,M,t=map(int,input().split())
A=list(map(int,input().split()))
C=list(map(int,input().split()))
C.sort()
F=[0]*(n+1)
for i in range(n):
    F[i+1]=F[i]+A[i]
Q=[]
z=0
w=C[0]-1
for c in C:
    i=c-1
    while Q and Q[0]<i:
        Q.pop(0)
    l,r=i,n
    while l<r-1:
        m=(l+r)//2
        if F[m+1]-F[i]<=t:
            l=m
        else:
            r=m
    for j in range(max(w,i),l+1):
        while Q and A[Q[-1]]>A[j]:
            Q.pop(-1)
        Q.append(j)
        w=j+1
    j=Q[0]
    z=max(z,j-i+((t-(F[j]-F[i]))//A[j]))
C=list(reversed(C))
for i in range(M):
    C[i]=n-C[i]+1
A=list(reversed(A))
F=[0]*(n+1)
for i in range(n):
    F[i+1]=F[i]+A[i]
Q=[]
w=C[0]-1
for c in C:
    i=c-1
    while Q and Q[0]<i:
        Q.pop(0)
    l,r=i,n
    while l<r-1:
        m=(l+r)//2
        if F[m+1]-F[i]<=t:
            l=m
        else:
            r=m
    for j in range(max(w,i),l+1):
        while Q and A[Q[-1]]>A[j]:
            Q.pop(-1)
        Q.append(j)
        w=j+1
    j=Q[0]
    z=max(z,j-i+((t-(F[j]-F[i]))//A[j]))
            
print(z)
