N,M = map(int,input().split()) assert(1<=N<=2*10**5) assert(1<=M<=2*10**5) b = list(map(int,input().split())) c = list(map(int,input().split())) assert(all(1<=b[i]<=M for i in range(N))) assert(all(1<=c[i]<=N for i in range(N)))