N,K=map(int,input().split()) P=list(map(int,input().split())) INF=float('inf') P=[-INF]+P+[INF] A=list(map(int,input().split())) A=[0]+A+[0] L=P[K]-A[K] R=P[K]+A[K] LF=1 RF=1 l=0 r=0 def Left(a): global R global L global LF global RF global l global r for i in range(a,10**5+5): if L<=P[K-i]: if L>P[K-i]-A[K-i]: L=P[K-i]-A[K-i] if R
=P[K+j]: if R
P[K+j]-A[K+j]: L=P[K+j]-A[K+j] LF=1 else: RF=0 r=j break for k in range(10**5+5): if RF==1: Right(r) elif LF==1: Left(l) else: break #print(j) print(max(l+r-1,1))