import sys input = sys.stdin.readline N,L=map(int,input().split()) X=list(map(int,input().split())) Y=list(map(int,input().split())) X2=[[x,1] for x in X] Y2=[[y,2] for y in Y] ALL=X2+Y2 ALL.sort() ALL_C=[ALL[0]+[1]] for i in range(1,2*N): if ALL[i][1]==ALL[i-1][1]: ALL_C[-1][2]+=1 else: ALL_C.append(ALL[i]+[1]) NOW=0 NOWkind=-1 EAT=0 ANS=0 LEN=len(ALL_C) i=0 while EAT<2*N: #print(ALL_C,NOW,NOWkind,ANS) if i==LEN: i=0 for j in range(LEN): if ALL_C[j][2]==0: continue else: ALL_C2=[ALL_C[j]] break for k in range(j+1,LEN): if ALL_C[k][2]==0: continue if ALL_C[k][1]==ALL_C2[-1][1]: ALL_C2[-1][2]+=ALL_C[k][2] else: ALL_C2.append(ALL_C[k]) ALL_C=ALL_C2 LEN=len(ALL_C) dist,kind,num=ALL_C[i] if num==0 or kind==NOWkind: i+=1 else: if NOW