import numpy as np

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

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

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

ans = 'No'

na = np.array(a)

nb = np.array(b)

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

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

        s = na[i:m+i, list(range(j, m+j))]

        if (s == nb).all():

            ans = 'Yes'

            break

print(ans)
a, b = list(map(int,input().split()))

A = [eval(input()) for _ in range(a)]

B = [eval(input()) for _ in range(b)]

ans = "No"

for i in range(a-b+1):

    for j in range(a-b+1):

        cnt = 0

        if A[i][j] == B[0][0]:

            for k in range(b):

                for l in range(b):

                    if A[i+k][j+l] == B[k][l]:

                        cnt += 1

                    if cnt == b**2:

                        ans = "Yes"



print(ans)
import numpy as np

n, m = list(map(int, input().split()))
a = [[j for j in eval(input())] for i in range(n)]
b = [[j for j in eval(input())] for i in range(m)]
ans = "No"
na = np.array(a)
nb = np.array(b)
for i in range(n - m + 1):
    for j in range(n - m + 1):
        s = na[i : m + i, list(range(j, m + j))]
        if (s == nb).all():
            ans = "Yes"
            break
print(ans)

a, b = list(map(int, input().split()))
A = [eval(input()) for _ in range(a)]
B = [eval(input()) for _ in range(b)]
ans = "No"
for i in range(a - b + 1):
    for j in range(a - b + 1):
        cnt = 0
        if A[i][j] == B[0][0]:
            for k in range(b):
                for l in range(b):
                    if A[i + k][j + l] == B[k][l]:
                        cnt += 1
                    if cnt == b**2:
                        ans = "Yes"
print(ans)

-import numpy as np - -n, m = list(map(int, input().split())) -a = [[j for j in eval(input())] for i in range(n)] -b = [[j for j in eval(input())] for i in range(m)] +a, b = list(map(int, input().split())) +A = [eval(input()) for _ in range(a)] +B = [eval(input()) for _ in range(b)] -na = np.array(a) -nb = np.array(b) -for i in range(n - m + 1): -    for j in range(n - m + 1): -        s = na[i : m + i, list(range(j, m + j))] -        if (s == nb).all(): -            ans = "Yes" -            break +for i in range(a - b + 1): +    for j in range(a - b + 1): +        cnt = 0 +        if A[i][j] == B[0][0]: +            for k in range(b): +                for l in range(b): +                    if A[i + k][j + l] == B[k][l]: +                        cnt += 1 +                    if cnt == b**2: +                        ans = "Yes"