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

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

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

lenB = M**2

flg=False

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

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

        if A[i][j] == B[0][0]:

            cnt=0

            for k in range(M):

                for l in range(M):

                    if A[i+k][j+l] == B[k][l]:

                        cnt += 1

            if cnt==M**2:

                flg=True

ans='Yes' if flg else 'No'

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

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

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

flg=False



def check(i, j):

    cnt=0

    for k in range(M):

        for l in range(M):

            if A[i+k][j+l] == B[k][l]:

                cnt += 1

    if cnt==M**2:

        return True

    

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

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

        if A[i][j] == B[0][0]:

            flg = check(i, j)

            if flg:

                break

    if flg:

        break

            

ans='Yes' if flg else 'No'

print(ans)
N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
lenB = M**2
flg = False
for i in range(N - M + 1):
    for j in range(N - M + 1):
        if A[i][j] == B[0][0]:
            cnt = 0
            for k in range(M):
                for l in range(M):
                    if A[i + k][j + l] == B[k][l]:
                        cnt += 1
            if cnt == M**2:
                flg = True
ans = "Yes" if flg else "No"
print(ans)

N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
flg = False


def check(i, j):
    cnt = 0
    for k in range(M):
        for l in range(M):
            if A[i + k][j + l] == B[k][l]:
                cnt += 1
    if cnt == M**2:
        return True


for i in range(N - M + 1):
    for j in range(N - M + 1):
        if A[i][j] == B[0][0]:
            flg = check(i, j)
            if flg:
                break
    if flg:
        break
ans = "Yes" if flg else "No"
print(ans)

-lenB = M**2 + + +def check(i, j): +    cnt = 0 +    for k in range(M): +        for l in range(M): +            if A[i + k][j + l] == B[k][l]: +                cnt += 1 +    if cnt == M**2: +        return True + + -            cnt = 0 -            for k in range(M): -                for l in range(M): -                    if A[i + k][j + l] == B[k][l]: -                        cnt += 1 -            if cnt == M**2: -                flg = True +            flg = check(i, j) +            if flg: +                break +    if flg: +        break