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

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

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



ans = 'No'

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

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

        C = []

        for k in range(m):

            c = A[i + k][j : j + m]

            C.append(c)

        if B == C:

            ans = 'Yes'

            break

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

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

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



ans = 'No'

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

    C = []

    for j in range(n):

        C.append(A[j][i : i + m])

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

        if B == C[k : k + m]:

            ans = 'Yes'

            break

            

print(ans)
n, m = list(map(int, input().split()))
A = [eval(input()) for _ in range(n)]
B = [eval(input()) for _ in range(m)]
ans = "No"
for i in range(n - m + 1):
    for j in range(n - m + 1):
        C = []
        for k in range(m):
            c = A[i + k][j : j + m]
            C.append(c)
        if B == C:
            ans = "Yes"
            break
print(ans)

n, m = list(map(int, input().split()))
A = [eval(input()) for i in range(n)]
B = [eval(input()) for i in range(m)]
ans = "No"
for i in range(n - m + 1):
    C = []
    for j in range(n):
        C.append(A[j][i : i + m])
    for k in range(n - m + 1):
        if B == C[k : k + m]:
            ans = "Yes"
            break
print(ans)

-A = [eval(input()) for _ in range(n)] -B = [eval(input()) for _ in range(m)] +A = [eval(input()) for i in range(n)] +B = [eval(input()) for i in range(m)] -    for j in range(n - m + 1): -        C = [] -        for k in range(m): -            c = A[i + k][j : j + m] -            C.append(c) -        if B == C: +    C = [] +    for j in range(n): +        C.append(A[j][i : i + m]) +    for k in range(n - m + 1): +        if B == C[k : k + m]: