import sys

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

A,B = [],[]

for i in range(N):

    A.append(eval(input()))

for i in range(M):

    B.append(eval(input()))



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

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

        ans = True

        for ii in range(M):

            for jj in range(M):

                if A[i+ii][j+jj] != B[ii][jj]: 

                    ans = False

        if ans:

            print("Yes")

            sys.exit()



print("No")
# Python3 (3.4.3)

import sys

input = sys.stdin.readline



# -------------------------------------------------------------

# function

# -------------------------------------------------------------





# -------------------------------------------------------------

# main

# -------------------------------------------------------------

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

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

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



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

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

        flg = True

        for h in range(M):

            for w in range(M):

                if B[h][w] != A[h+dh][w+dw]:

                    flg = False

                    break

        if flg:

            print("Yes")

            sys.exit()



print("No")

import sys

N, M = list(map(int, input().split()))
A, B = [], []
for i in range(N):
    A.append(eval(input()))
for i in range(M):
    B.append(eval(input()))
for i in range(N - M + 1):
    for j in range(N - M + 1):
        ans = True
        for ii in range(M):
            for jj in range(M):
                if A[i + ii][j + jj] != B[ii][jj]:
                    ans = False
        if ans:
            print("Yes")
            sys.exit()
print("No")

# Python3 (3.4.3)
import sys

input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N, M = list(map(int, input().split()))
A = [input().rstrip() for _ in range(N)]
B = [input().rstrip() for _ in range(M)]
for dh in range(N - M + 1):
    for dw in range(N - M + 1):
        flg = True
        for h in range(M):
            for w in range(M):
                if B[h][w] != A[h + dh][w + dw]:
                    flg = False
                    break
        if flg:
            print("Yes")
            sys.exit()
print("No")

+# Python3 (3.4.3) +input = sys.stdin.readline +# function +# main -A, B = [], [] -for i in range(N): -    A.append(eval(input())) -for i in range(M): -    B.append(eval(input())) -for i in range(N - M + 1): -    for j in range(N - M + 1): -        ans = True -        for ii in range(M): -            for jj in range(M): -                if A[i + ii][j + jj] != B[ii][jj]: -                    ans = False -        if ans: +A = [input().rstrip() for _ in range(N)] +B = [input().rstrip() for _ in range(M)] +for dh in range(N - M + 1): +    for dw in range(N - M + 1): +        flg = True +        for h in range(M): +            for w in range(M): +                if B[h][w] != A[h + dh][w + dw]: +                    flg = False +                    break +        if flg: