import math

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

A=[0]*N

B=[0]*M

for i in range(N):

  A[i]=str(eval(input()))

for i in range(M):

  B[i]=str(eval(input()))

k=math.ceil(N/M)



def macthing(y,x):

  flag=0

  for p in range(M):

    if A[y+p][x:x+M]!=B[p]:

      flag=1

      break

  if flag==0:

    return True

  else:

    return False



for i in range(k):

  for j in range(k):

    if macthing(i,j):

      print('Yes')

      exit()

print('No')

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

A=[0]*N

B=[0]*M

for i in range(N):

  A[i]=str(eval(input()))

for i in range(M):

  B[i]=str(eval(input()))

k=N//M + N%M



def macthing(y,x):

  flag=0

  for p in range(M):

    if A[y+p][x:x+M]!=B[p]:

      flag=1

      break

  if flag==0:

    return True

  else:

    return False



for i in range(k):

  for j in range(k):

    if macthing(i,j):

      print('Yes')

      exit()

print('No')

import math

N, M = list(map(int, input().split()))
A = [0] * N
B = [0] * M
for i in range(N):
    A[i] = str(eval(input()))
for i in range(M):
    B[i] = str(eval(input()))
k = math.ceil(N / M)


def macthing(y, x):
    flag = 0
    for p in range(M):
        if A[y + p][x : x + M] != B[p]:
            flag = 1
            break
    if flag == 0:
        return True
    else:
        return False


for i in range(k):
    for j in range(k):
        if macthing(i, j):
            print("Yes")
            exit()
print("No")

N, M = list(map(int, input().split()))
A = [0] * N
B = [0] * M
for i in range(N):
    A[i] = str(eval(input()))
for i in range(M):
    B[i] = str(eval(input()))
k = N // M + N % M


def macthing(y, x):
    flag = 0
    for p in range(M):
        if A[y + p][x : x + M] != B[p]:
            flag = 1
            break
    if flag == 0:
        return True
    else:
        return False


for i in range(k):
    for j in range(k):
        if macthing(i, j):
            print("Yes")
            exit()
print("No")

-import math - -k = math.ceil(N / M) +k = N // M + N % M