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

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

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



dxy = []

for y in range(M) :

    for x in range(M) :

        dxy.append((x,y))

flag = 0

for y in range(N) :

    for x in range(N) :

        if A[y][x] == B[0][0] and flag == 0 :

            counter = 0

            for dx,dy in dxy :

                nx = x+dx

                ny = y+dy

                if (0 <= nx <= N-1) and (0 <= ny <= N-1) and flag == 0 :

                    if A[ny][nx] == B[dy][dx] :

                        counter += 1

                if counter == M**2 :

                    flag = 1

if flag == 1 :

    print("Yes")

else :

    print("No")

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

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

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

dxy = []

for y in range(M) :

    for x in range(M) :

        dxy.append((x,y))

flag = 0

for y in range(N) :

    for x in range(N) :

        if A[y][x] == B[0][0] and flag == 0 :

            counter = 0

            for dx,dy in dxy :

                if flag == 0 :

                    nx = x+dx

                    ny = y+dy

                    if not (0 <= nx <= N-1) :

                        break

                    if not (0 <= ny <= N-1) :

                        break

                    if A[ny][nx] == B[dy][dx] :

                        counter += 1

            if counter == M**2 :

                flag = 1

if flag == 1 :

    print("Yes")

else :

    print("No")

N, M = list(map(int, input().split()))
A = [eval(input()) for i in range(N)]
B = [eval(input()) for i in range(M)]
dxy = []
for y in range(M):
    for x in range(M):
        dxy.append((x, y))
flag = 0
for y in range(N):
    for x in range(N):
        if A[y][x] == B[0][0] and flag == 0:
            counter = 0
            for dx, dy in dxy:
                nx = x + dx
                ny = y + dy
                if (0 <= nx <= N - 1) and (0 <= ny <= N - 1) and flag == 0:
                    if A[ny][nx] == B[dy][dx]:
                        counter += 1
                if counter == M**2:
                    flag = 1
if flag == 1:
    print("Yes")
else:
    print("No")

N, M = list(map(int, input().split()))
A = [eval(input()) for i in range(N)]
B = [eval(input()) for i in range(M)]
dxy = []
for y in range(M):
    for x in range(M):
        dxy.append((x, y))
flag = 0
for y in range(N):
    for x in range(N):
        if A[y][x] == B[0][0] and flag == 0:
            counter = 0
            for dx, dy in dxy:
                if flag == 0:
                    nx = x + dx
                    ny = y + dy
                    if not (0 <= nx <= N - 1):
                        break
                    if not (0 <= ny <= N - 1):
                        break
                    if A[ny][nx] == B[dy][dx]:
                        counter += 1
            if counter == M**2:
                flag = 1
if flag == 1:
    print("Yes")
else:
    print("No")

-                nx = x + dx -                ny = y + dy -                if (0 <= nx <= N - 1) and (0 <= ny <= N - 1) and flag == 0: +                if flag == 0: +                    nx = x + dx +                    ny = y + dy +                    if not (0 <= nx <= N - 1): +                        break +                    if not (0 <= ny <= N - 1): +                        break -                if counter == M**2: -                    flag = 1 +            if counter == M**2: +                flag = 1