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

A = []

B = []

# for _ in range(N):

#     A.append(list(input()))

# for _ in range(M):

#     B.append(list(input()))



for _ in range(N):

    A.append(eval(input()))

for _ in range(M):

    B.append(eval(input()))



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

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

        # match

        flag = True

        for k in range(M):

            for l in range(M):

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

                    pass

                else:

                    flag = False

                    break



            if not flag:

                break



        if flag:

            break



    if flag:

        break



if flag:

    print("Yes")

else:

    print("No")

def main():

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

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

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



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

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

            flag = True

            for i in range(M):

                for j in range(M):

                    if A[h + i][w + j] == B[i][j]:

                        continue

                    else:

                        flag = False

                        break

                if not flag:

                    break

            if flag:

                print("Yes")

                return

    else:

        print("No")





main()

N, M = list(map(int, input().split()))
A = []
B = []
# for _ in range(N):
#     A.append(list(input()))
# for _ in range(M):
#     B.append(list(input()))
for _ in range(N):
    A.append(eval(input()))
for _ in range(M):
    B.append(eval(input()))
for i in range(N - M + 1):
    for j in range(N - M + 1):
        # match
        flag = True
        for k in range(M):
            for l in range(M):
                if A[i + k][j + l] == B[k][l]:
                    pass
                else:
                    flag = False
                    break
            if not flag:
                break
        if flag:
            break
    if flag:
        break
if flag:
    print("Yes")
else:
    print("No")

def main():
    N, M = list(map(int, input().split()))
    A = [eval(input()) for _ in range(N)]
    B = [eval(input()) for _ in range(M)]
    for h in range(N - M + 1):
        for w in range(N - M + 1):
            flag = True
            for i in range(M):
                for j in range(M):
                    if A[h + i][w + j] == B[i][j]:
                        continue
                    else:
                        flag = False
                        break
                if not flag:
                    break
            if flag:
                print("Yes")
                return
    else:
        print("No")


main()

-N, M = list(map(int, input().split())) -A = [] -B = [] -# for _ in range(N): -#     A.append(list(input())) -# for _ in range(M): -#     B.append(list(input())) -for _ in range(N): -    A.append(eval(input())) -for _ in range(M): -    B.append(eval(input())) -for i in range(N - M + 1): -    for j in range(N - M + 1): -        # match -        flag = True -        for k in range(M): -            for l in range(M): -                if A[i + k][j + l] == B[k][l]: -                    pass -                else: -                    flag = False +def main(): +    N, M = list(map(int, input().split())) +    A = [eval(input()) for _ in range(N)] +    B = [eval(input()) for _ in range(M)] +    for h in range(N - M + 1): +        for w in range(N - M + 1): +            flag = True +            for i in range(M): +                for j in range(M): +                    if A[h + i][w + j] == B[i][j]: +                        continue +                    else: +                        flag = False +                        break +                if not flag: -            if not flag: -                break -        if flag: -            break -    if flag: -        break -if flag: -    print("Yes") -else: -    print("No") +            if flag: +                print("Yes") +                return +    else: +        print("No") + + +main()