n,m = list(map(int,input().split()))

a_list = [eval(input()) for _ in range(n)]

b_list = [eval(input()) for _ in range(m)]

count = 0

res = []

for i in range(n-m+1):

    for j in range(n-m+1):

        f = True

        for k in range(m):

            for l in range(m):

                if a_list[i+k][j+l] != b_list[k][l]:

                    f = False

                    break

            if not f:

                break

        if f:

            print('Yes')

            exit()

print('No')
n,m = list(map(int,input().split()))

a_list = [eval(input()) for _ in range(n)]

b_list = [eval(input()) for _ in range(m)]

for i in range(n-m+1):

    for j in range(n-m+1):

        f = True

        for k in range(m):

            for l in range(m):

                if a_list[i+k][j+l] != b_list[k][l]:

                    f = False

                    break

            if not f:

                break

        if f:

            print('Yes')

            exit()

print('No')
n, m = list(map(int, input().split()))
a_list = [eval(input()) for _ in range(n)]
b_list = [eval(input()) for _ in range(m)]
count = 0
res = []
for i in range(n - m + 1):
    for j in range(n - m + 1):
        f = True
        for k in range(m):
            for l in range(m):
                if a_list[i + k][j + l] != b_list[k][l]:
                    f = False
                    break
            if not f:
                break
        if f:
            print("Yes")
            exit()
print("No")

n, m = list(map(int, input().split()))
a_list = [eval(input()) for _ in range(n)]
b_list = [eval(input()) for _ in range(m)]
for i in range(n - m + 1):
    for j in range(n - m + 1):
        f = True
        for k in range(m):
            for l in range(m):
                if a_list[i + k][j + l] != b_list[k][l]:
                    f = False
                    break
            if not f:
                break
        if f:
            print("Yes")
            exit()
print("No")

-count = 0 -res = []