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



A=[]

B=[]



for i in range(N):

    A.append(list(eval(input())))

    

for i in range(M):

    B.append(list(eval(input())))



k=N-M+1

ans=False



for i in range(k):

    for j in range(k):

        flg=True

        

        for p in range(M):

            for q in range(M):

                if A[i+p][j+q] != B[p][q]:

                    flg=False

                    

        ans=flg

        if ans:

            break

    if ans:

        break



if ans:

    print("Yes")

else:

    print("No")
# coding: utf-8

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

picN=[]

picM=[]



for i in range(N):

    L=list(eval(input()))

    picN.append(L)



for i in range(M):

    L=list(eval(input()))

    picM.append(L)



K=N-M



for i in range(K+1):

    for j in range(K+1):

        flg=True

        for a in range(M):

            for b in range(M):

                if picN[a+i][b+j]!=picM[a][b]:

                    flg=False

        if flg:

            break

    if flg:

        break



if flg:

    print("Yes")

else:

    print("No")
N, M = list(map(int, input().split()))
A = []
B = []
for i in range(N):
    A.append(list(eval(input())))
for i in range(M):
    B.append(list(eval(input())))
k = N - M + 1
ans = False
for i in range(k):
    for j in range(k):
        flg = True
        for p in range(M):
            for q in range(M):
                if A[i + p][j + q] != B[p][q]:
                    flg = False
        ans = flg
        if ans:
            break
    if ans:
        break
if ans:
    print("Yes")
else:
    print("No")

# coding: utf-8
N, M = list(map(int, input().split()))
picN = []
picM = []
for i in range(N):
    L = list(eval(input()))
    picN.append(L)
for i in range(M):
    L = list(eval(input()))
    picM.append(L)
K = N - M
for i in range(K + 1):
    for j in range(K + 1):
        flg = True
        for a in range(M):
            for b in range(M):
                if picN[a + i][b + j] != picM[a][b]:
                    flg = False
        if flg:
            break
    if flg:
        break
if flg:
    print("Yes")
else:
    print("No")

+# coding: utf-8 -A = [] -B = [] +picN = [] +picM = [] -    A.append(list(eval(input()))) +    L = list(eval(input())) +    picN.append(L) -    B.append(list(eval(input()))) -k = N - M + 1 -ans = False -for i in range(k): -    for j in range(k): +    L = list(eval(input())) +    picM.append(L) +K = N - M +for i in range(K + 1): +    for j in range(K + 1): -        for p in range(M): -            for q in range(M): -                if A[i + p][j + q] != B[p][q]: +        for a in range(M): +            for b in range(M): +                if picN[a + i][b + j] != picM[a][b]: -        ans = flg -        if ans: +        if flg: -    if ans: +    if flg: -if ans: +if flg: