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

A_list = [eval(input()) for i in range(N)]

B_list = [eval(input()) for i in range(M)]



all_segment = []

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

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

        segment = [width_list[width: width + M] for width_list in A_list[height: height + M]]

        all_segment.append(segment)



if B_list in all_segment:

    print('Yes')

else:

    print('No')

import sys

readline = sys.stdin.readline



def main():

    N, M = list(map(int, readline().rstrip().split()))

    A = [readline().rstrip() for _ in range(N)]

    B = [readline().rstrip() for _ in range(M)]

    if A == B:

        print('Yes')

        return

    for h in range(N-M):

        for w in range(N-M):

            a = [l[w:w+M] for l in A[h:h+M]]

            if a == B:

                print('Yes')

                return



    print('No')



if __name__ == '__main__':

    main()
N, M = list(map(int, input().split()))
A_list = [eval(input()) for i in range(N)]
B_list = [eval(input()) for i in range(M)]
all_segment = []
for width in range(N - M + 1):
    for height in range(N - M + 1):
        segment = [
            width_list[width : width + M] for width_list in A_list[height : height + M]
        ]
        all_segment.append(segment)
if B_list in all_segment:
    print("Yes")
else:
    print("No")

import sys

readline = sys.stdin.readline


def main():
    N, M = list(map(int, readline().rstrip().split()))
    A = [readline().rstrip() for _ in range(N)]
    B = [readline().rstrip() for _ in range(M)]
    if A == B:
        print("Yes")
        return
    for h in range(N - M):
        for w in range(N - M):
            a = [l[w : w + M] for l in A[h : h + M]]
            if a == B:
                print("Yes")
                return
    print("No")


if __name__ == "__main__":
    main()

-N, M = list(map(int, input().split())) -A_list = [eval(input()) for i in range(N)] -B_list = [eval(input()) for i in range(M)] -all_segment = [] -for width in range(N - M + 1): -    for height in range(N - M + 1): -        segment = [ -            width_list[width : width + M] for width_list in A_list[height : height + M] -        ] -        all_segment.append(segment) -if B_list in all_segment: -    print("Yes") -else: +import sys + +readline = sys.stdin.readline + + +def main(): +    N, M = list(map(int, readline().rstrip().split())) +    A = [readline().rstrip() for _ in range(N)] +    B = [readline().rstrip() for _ in range(M)] +    if A == B: +        print("Yes") +        return +    for h in range(N - M): +        for w in range(N - M): +            a = [l[w : w + M] for l in A[h : h + M]] +            if a == B: +                print("Yes") +                return + + +if __name__ == "__main__": +    main()