import re



n, m = list(map(int, input().split()))

a = [input().strip() for _ in range(n)]

b = [input().strip() for _ in range(m)]

for idx_a, arow in enumerate(a[:n-m+1]):

  for idx_obj in re.finditer(b[0], arow):

    falg = True

    for i in range(1,m):

      if b[i] != a[idx_a+i][idx_obj.start():idx_obj.end()]:

        falg = False

    if falg is True:

      print('Yes')

      exit()

print('No')
def is_same(si, sj):

    for i in range(M):

        for j in range(M):

            if gridsA[sj + j][si + i] != gridsB[j][i]:

                return False

    return True





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

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

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



if N == M:

    if is_same(0, 0):

        print('Yes')

    else:

        print('No')

else:

    for i in range(N - M):

        for j in range(N - M):

            if is_same(i, j):

                print('Yes')

                exit()

    print('No')

import re

n, m = list(map(int, input().split()))
a = [input().strip() for _ in range(n)]
b = [input().strip() for _ in range(m)]
for idx_a, arow in enumerate(a[: n - m + 1]):
    for idx_obj in re.finditer(b[0], arow):
        falg = True
        for i in range(1, m):
            if b[i] != a[idx_a + i][idx_obj.start() : idx_obj.end()]:
                falg = False
        if falg is True:
            print("Yes")
            exit()
print("No")

def is_same(si, sj):
    for i in range(M):
        for j in range(M):
            if gridsA[sj + j][si + i] != gridsB[j][i]:
                return False
    return True


N, M = list(map(int, input().split()))
gridsA = [eval(input()) for _ in range(N)]
gridsB = [eval(input()) for _ in range(M)]
if N == M:
    if is_same(0, 0):
        print("Yes")
    else:
        print("No")
else:
    for i in range(N - M):
        for j in range(N - M):
            if is_same(i, j):
                print("Yes")
                exit()
    print("No")

-import re +def is_same(si, sj): +    for i in range(M): +        for j in range(M): +            if gridsA[sj + j][si + i] != gridsB[j][i]: +                return False +    return True -n, m = list(map(int, input().split())) -a = [input().strip() for _ in range(n)] -b = [input().strip() for _ in range(m)] -for idx_a, arow in enumerate(a[: n - m + 1]): -    for idx_obj in re.finditer(b[0], arow): -        falg = True -        for i in range(1, m): -            if b[i] != a[idx_a + i][idx_obj.start() : idx_obj.end()]: -                falg = False -        if falg is True: -            print("Yes") -            exit() -print("No") + +N, M = list(map(int, input().split())) +gridsA = [eval(input()) for _ in range(N)] +gridsB = [eval(input()) for _ in range(M)] +if N == M: +    if is_same(0, 0): +        print("Yes") +    else: +        print("No") +else: +    for i in range(N - M): +        for j in range(N - M): +            if is_same(i, j): +                print("Yes") +                exit() +    print("No")