n,m = list(map(int,input().split()))

a = []

for i in range(n):

    a.append(eval(input()))

b = []

for g in range(m):

    b.append(eval(input()))

#print(a)

#print(b)

ans = 'No'

for c in range(n-m+1):

    for d in range(n-m+1):

        flag = 0

        for e in range(m):

            if a[d+e][c:c+m] != b[e]:

                flag = 1

        if flag == 0:

            ans = 'Yes'



print(ans)
n,m = list(map(int,input().split()))

a = []

for i in range(n):

    a.append(eval(input()))

b = []

for g in range(m):

    b.append(eval(input()))

#print(a)

#print(b)

ans = 'No'



for c in range(n-m+1):

    for d in range(n-m+1):

        C = [a[d+e][c:c+m] for e in range(m)]

        if C == b:

            ans = 'Yes'

    

print(ans)
n, m = list(map(int, input().split()))
a = []
for i in range(n):
    a.append(eval(input()))
b = []
for g in range(m):
    b.append(eval(input()))
# print(a)
# print(b)
ans = "No"
for c in range(n - m + 1):
    for d in range(n - m + 1):
        flag = 0
        for e in range(m):
            if a[d + e][c : c + m] != b[e]:
                flag = 1
        if flag == 0:
            ans = "Yes"
print(ans)

n, m = list(map(int, input().split()))
a = []
for i in range(n):
    a.append(eval(input()))
b = []
for g in range(m):
    b.append(eval(input()))
# print(a)
# print(b)
ans = "No"
for c in range(n - m + 1):
    for d in range(n - m + 1):
        C = [a[d + e][c : c + m] for e in range(m)]
        if C == b:
            ans = "Yes"
print(ans)

-        flag = 0 -        for e in range(m): -            if a[d + e][c : c + m] != b[e]: -                flag = 1 -        if flag == 0: +        C = [a[d + e][c : c + m] for e in range(m)] +        if C == b: