n, m = map(int, input().split())
list1 = list(map(int, input().split()))
list2 = list(map(int, input().split()))
b = True
for i in list2:
if i in list1:
b = True
else:
b = False
break
if b == False:
print("No")
else:
print("Yes")
# 6 3
# 1 5 4 -2 6 9
# 4 -2 6