#まだ

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

a_l=[]

b_l=[]

for i in range(N):

    a_l.append(list(eval(input())))

for i in range(M):

    b_l.extend(eval(input()))

count=0

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

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

        tmp=[]

        for i in range(M):

            for j in range(M):

                tmp.append(a_l[t+i][k+j])

        if tmp == b_l:

            break

    if tmp == b_l:

        print('Yes')

        count=1

        break

    else:

        continue

if count==0:

    print('No')

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

a_l=[]

b_l=[]

for i in range(N):

    a_l.append(list(eval(input())))

for i in range(M):

    b_l.extend(eval(input()))

count=0

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

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

        tmp=[]

        for i in range(M):

            for j in range(M):

                tmp.append(a_l[t+i][k+j])

        if tmp == b_l:

            print('Yes')

            exit()

        else:

            continue

print('No')

# まだ
N, M = list(map(int, input().split()))
a_l = []
b_l = []
for i in range(N):
    a_l.append(list(eval(input())))
for i in range(M):
    b_l.extend(eval(input()))
count = 0
for t in range(N - M + 1):
    for k in range(N - M + 1):
        tmp = []
        for i in range(M):
            for j in range(M):
                tmp.append(a_l[t + i][k + j])
        if tmp == b_l:
            break
    if tmp == b_l:
        print("Yes")
        count = 1
        break
    else:
        continue
if count == 0:
    print("No")

N, M = list(map(int, input().split()))
a_l = []
b_l = []
for i in range(N):
    a_l.append(list(eval(input())))
for i in range(M):
    b_l.extend(eval(input()))
count = 0
for t in range(N - M + 1):
    for k in range(N - M + 1):
        tmp = []
        for i in range(M):
            for j in range(M):
                tmp.append(a_l[t + i][k + j])
        if tmp == b_l:
            print("Yes")
            exit()
        else:
            continue
print("No")

-# まだ -            break -    if tmp == b_l: -        print("Yes") -        count = 1 -        break -    else: -        continue -if count == 0: -    print("No") +            print("Yes") +            exit() +        else: +            continue +print("No")