def match(x,y):

    ret = True

    for i in range(m):

        for j in range(m):

            if A[y+i][x+j] != B[i][j]:

                ret = False

    return ret





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

A = []

for i in range(n):

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

B = []

for i in range(m):

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



flg = False

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

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

        if match(i,j):

            flg = True

print(('Yes' if flg else 'No'))
n,m = list(map(int,input().split()))

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

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

ans = False

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

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

        flg = True

        for e, k in enumerate(range(m)):

            if A[i+e][j:j+m] != B[k]:

                flg = False

        if flg:

            ans = True

            break

print(('Yes' if ans else 'No'))

def match(x, y):
    ret = True
    for i in range(m):
        for j in range(m):
            if A[y + i][x + j] != B[i][j]:
                ret = False
    return ret


n, m = list(map(int, input().split()))
A = []
for i in range(n):
    A.append(list(eval(input())))
B = []
for i in range(m):
    B.append(list(eval(input())))
flg = False
for i in range(n - m + 1):
    for j in range(n - m + 1):
        if match(i, j):
            flg = True
print(("Yes" if flg else "No"))

n, m = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(n)]
B = [list(eval(input())) for _ in range(m)]
ans = False
for i in range(n - m + 1):
    for j in range(n - m + 1):
        flg = True
        for e, k in enumerate(range(m)):
            if A[i + e][j : j + m] != B[k]:
                flg = False
        if flg:
            ans = True
            break
print(("Yes" if ans else "No"))

-def match(x, y): -    ret = True -    for i in range(m): -        for j in range(m): -            if A[y + i][x + j] != B[i][j]: -                ret = False -    return ret - - -A = [] -for i in range(n): -    A.append(list(eval(input()))) -B = [] -for i in range(m): -    B.append(list(eval(input()))) -flg = False +A = [list(eval(input())) for _ in range(n)] +B = [list(eval(input())) for _ in range(m)] +ans = False -        if match(i, j): -            flg = True -print(("Yes" if flg else "No")) +        flg = True +        for e, k in enumerate(range(m)): +            if A[i + e][j : j + m] != B[k]: +                flg = False +        if flg: +            ans = True +            break +print(("Yes" if ans else "No"))