from collections import defaultdict





def main():

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

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

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



    for sy in range(N):

        for sx in range(N):



            ok = True

            for y in range(M):

                for x in range(M):

                    if sy + y < N and sx + x < N:

                        ok &= A[sy + y][sx + x] == B[y][x]

                    else:

                        ok = False



            if ok:

                print("Yes")

                return

    print("No")





if __name__ == '__main__':

    main()

from collections import defaultdict





def main():

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

    A, B = [], []

    for _ in range(N):

        A.append(eval(input()))

    for _ in range(M):

        B.append(eval(input()))



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

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

            ok = True

            for by in range(M):

                for bx in range(M):

                    if A[y + by][x + bx] != B[by][bx]:

                        ok = False

            if ok:

                print("Yes")

                return

    print("No")



if __name__ == '__main__':

    main()

from collections import defaultdict


def main():
    N, M = list(map(int, input().split()))
    A = [eval(input()) for _ in range(N)]
    B = [eval(input()) for _ in range(M)]
    for sy in range(N):
        for sx in range(N):
            ok = True
            for y in range(M):
                for x in range(M):
                    if sy + y < N and sx + x < N:
                        ok &= A[sy + y][sx + x] == B[y][x]
                    else:
                        ok = False
            if ok:
                print("Yes")
                return
    print("No")


if __name__ == "__main__":
    main()

from collections import defaultdict


def main():
    N, M = list(map(int, input().split()))
    A, B = [], []
    for _ in range(N):
        A.append(eval(input()))
    for _ in range(M):
        B.append(eval(input()))
    for y in range(N - M + 1):
        for x in range(N - M + 1):
            ok = True
            for by in range(M):
                for bx in range(M):
                    if A[y + by][x + bx] != B[by][bx]:
                        ok = False
            if ok:
                print("Yes")
                return
    print("No")


if __name__ == "__main__":
    main()

-    A = [eval(input()) for _ in range(N)] -    B = [eval(input()) for _ in range(M)] -    for sy in range(N): -        for sx in range(N): +    A, B = [], [] +    for _ in range(N): +        A.append(eval(input())) +    for _ in range(M): +        B.append(eval(input())) +    for y in range(N - M + 1): +        for x in range(N - M + 1): -            for y in range(M): -                for x in range(M): -                    if sy + y < N and sx + x < N: -                        ok &= A[sy + y][sx + x] == B[y][x] -                    else: +            for by in range(M): +                for bx in range(M): +                    if A[y + by][x + bx] != B[by][bx]: