N,M = list(map(int,input().split()))

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

B = [eval(input()) for j in range(M)]

ans = "No"

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 B[k][l] == A[i+k][j+l]:

                    count += 1

        if count == M*M:

            ans = "Yes"

            break

    else:

        continue

    break

print(ans)
N,M = list(map(int,input().split()))

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

B = [list(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(i,i+M):

            C.append(A[k][j:j+M])

        if B == C:

            ans = "Yes"



print(ans)
N, M = list(map(int, input().split()))
A = [eval(input()) for i in range(N)]
B = [eval(input()) for j in range(M)]
ans = "No"
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 B[k][l] == A[i + k][j + l]:
                    count += 1
        if count == M * M:
            ans = "Yes"
            break
    else:
        continue
    break
print(ans)

N, M = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(N)]
B = [list(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(i, i + M):
            C.append(A[k][j : j + M])
        if B == C:
            ans = "Yes"
print(ans)

-A = [eval(input()) for i in range(N)] -B = [eval(input()) for j in range(M)] +A = [list(eval(input())) for _ in range(N)] +B = [list(eval(input())) for _ in range(M)] -        count = 0 -        for k in range(M): -            for l in range(M): -                if B[k][l] == A[i + k][j + l]: -                    count += 1 -        if count == M * M: +        C = [] +        for k in range(i, i + M): +            C.append(A[k][j : j + M]) +        if B == C: -            break -    else: -        continue -    break