from collections import Counter n, k = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) if Counter(A) != Counter(B): print("No") else: if n < k: if A == B: print("Yes") else: print("No") else: print("Yes")