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

nn = []

mm = []

for i in range(n):

    nn.append(list(eval(input())))

for i in range(m):

    mm.append(list(eval(input())))

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

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

        count = 0

        for k in range(m):

            for l in range(m):

                if nn[i+k][j+l] != mm[k][l]:

                    break

                else:

                    count += 1

        if count == m*m:

            print("Yes")

            exit()

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

a = [eval(input()) for i in range(n)]

b = [eval(input()) for i in range(m)]

ans = 'Yes'

for i in range(n):

    for j in range(m):

        if b[j] not in a[i]:

            ans = 'No'

print(ans)
n, m = list(map(int, input().split()))
nn = []
mm = []
for i in range(n):
    nn.append(list(eval(input())))
for i in range(m):
    mm.append(list(eval(input())))
for i in range(n - m + 1):
    for j in range(n - m + 1):
        count = 0
        for k in range(m):
            for l in range(m):
                if nn[i + k][j + l] != mm[k][l]:
                    break
                else:
                    count += 1
        if count == m * m:
            print("Yes")
            exit()
print("No")

n, m = list(map(int, input().split()))
a = [eval(input()) for i in range(n)]
b = [eval(input()) for i in range(m)]
ans = "Yes"
for i in range(n):
    for j in range(m):
        if b[j] not in a[i]:
            ans = "No"
print(ans)

-nn = [] -mm = [] +a = [eval(input()) for i in range(n)] +b = [eval(input()) for i in range(m)] +ans = "Yes" -    nn.append(list(eval(input()))) -for i in range(m): -    mm.append(list(eval(input()))) -for i in range(n - m + 1): -    for j in range(n - m + 1): -        count = 0 -        for k in range(m): -            for l in range(m): -                if nn[i + k][j + l] != mm[k][l]: -                    break -                else: -                    count += 1 -        if count == m * m: -            print("Yes") -            exit() -print("No") +    for j in range(m): +        if b[j] not in a[i]: +            ans = "No" +print(ans)