ارسال شماره 803
m, n = map(int, input().split())
L = list(map(int,input().split()))
l = list(map(int,input().split()))
if l in L:
print("YES")
else:
print("NO")
m, n = map(int, input().split())
L = list(map(int,input().split()))
l = list(map(int,input().split()))
if l in L:
print("YES")
else:
print("NO")