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

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

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

#ans = False

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

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

        flg = True

        for i in range(M):

            for j in range(M):

                if A[i+dx][j+dy] != B[i][j]:

                    flg = False

        if flg:

            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)]

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

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

        flg = True

        for i in range(M):

          if A[i+dx][dy:dy+M] != B[i]:

            flg = False

            break

        if flg:

          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)]
# ans = False
for dx in range(N - M + 1):
    for dy in range(N - M + 1):
        flg = True
        for i in range(M):
            for j in range(M):
                if A[i + dx][j + dy] != B[i][j]:
                    flg = False
        if flg:
            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)]
for dx in range(N - M + 1):
    for dy in range(N - M + 1):
        flg = True
        for i in range(M):
            if A[i + dx][dy : dy + M] != B[i]:
                flg = False
                break
        if flg:
            print("Yes")
            exit()
print("No")

-# ans = False -            for j in range(M): -                if A[i + dx][j + dy] != B[i][j]: -                    flg = False +            if A[i + dx][dy : dy + M] != B[i]: +                flg = False +                break