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

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

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

for i in range(N-M+1):

    for j in range(N-M+1):

        c = 1

        for k in range(M):

            if A[i+k][j:j+M] != B[k]:

                c = 0

        if c:

            print('Yes')

            exit()

print('No')

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

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

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

print(('Yes'if any([A[i+k][j:j+M]for k in range(M)]==B for i in range(N-M+1)for j in range(N-M+1)) else'No'))

N, M = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(N)]
B = [list(eval(input())) for _ in range(M)]
for i in range(N - M + 1):
    for j in range(N - M + 1):
        c = 1
        for k in range(M):
            if A[i + k][j : j + M] != B[k]:
                c = 0
        if c:
            print("Yes")
            exit()
print("No")

N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
print(
    (
        "Yes"
        if any(
            [A[i + k][j : j + M] for k in range(M)] == B
            for i in range(N - M + 1)
            for j in range(N - M + 1)
        )
        else "No"
    )
)

-A = [list(eval(input())) for _ in range(N)] -B = [list(eval(input())) for _ in range(M)] -for i in range(N - M + 1): -    for j in range(N - M + 1): -        c = 1 -        for k in range(M): -            if A[i + k][j : j + M] != B[k]: -                c = 0 -        if c: -            print("Yes") -            exit() -print("No") +A = [eval(input()) for _ in range(N)] +B = [eval(input()) for _ in range(M)] +print( +    ( +        "Yes" +        if any( +            [A[i + k][j : j + M] for k in range(M)] == B +            for i in range(N - M + 1) +            for j in range(N - M + 1) +        ) +        else "No" +    ) +)