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

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

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



ans = "No"



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

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

        c = 0

        for x in range(M):

            for y in range(M):

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

                    c += 1

        if c == M ** 2:

            ans = "Yes"

            break



print(ans)

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

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

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



ans = "No"



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

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

        c = 0

        for x in range(M):

            if A[x + i][j:j + M] == B[x]:

                c += 1

        if c == M:

            ans = "Yes"

            break

    else:

        continue

    break



print(ans)

N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
ans = "No"
for i in range(N - M + 1):
    for j in range(N - M + 1):
        c = 0
        for x in range(M):
            for y in range(M):
                if A[x + i][y + j] == B[x][y]:
                    c += 1
        if c == M**2:
            ans = "Yes"
            break
print(ans)

N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
ans = "No"
for i in range(N - M + 1):
    for j in range(N - M + 1):
        c = 0
        for x in range(M):
            if A[x + i][j : j + M] == B[x]:
                c += 1
        if c == M:
            ans = "Yes"
            break
    else:
        continue
    break
print(ans)

-            for y in range(M): -                if A[x + i][y + j] == B[x][y]: -                    c += 1 -        if c == M**2: +            if A[x + i][j : j + M] == B[x]: +                c += 1 +        if c == M: +    else: +        continue +    break