You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.

A pixel is the smallest element of an image, and in this problem it is a square of size 1×1.

Also, the given images are binary images, and the color of each pixel is either white or black.  
In the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.

The image A is given as N strings A_1,...,A_N.

The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).

Similarly, the template image B is given as M strings B_1,...,B_M.

The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).  
Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.  

-----Constraints-----
 - 1≦M≦N≦50 
 - A_i is a string of length N consisting of # and ..
 - B_i is a string of length M consisting of # and ..

-----Input-----
The input is given from Standard Input in the following format:
N M
A_1
A_2
:  
A_N
B_1
B_2
:  
B_M

-----Output-----
Print Yes if the template image B is contained in the image A. Print No otherwise.

-----Sample Input-----
3 2
#.#
.#.
#.#
#.
.#

-----Sample Output-----
Yes

The template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.

Difficulty: introductory

Starter code:

Solutions:
n, m = map(int, input().split())
a = ["" for _ in range(n)]
b = ["" for _ in range(m)]
for i in range(n):
    a[i] = str(input())
for i in range(m):
    b[i] = str(input())
def check(ini_x, ini_y):
    nonlocal n, m, a, b
    for x in range(m):
        for y in range(m):
            if a[ini_x + x][ini_y + y] != b[x][y]:
                return False
    return True
for i in range(n - m + 1):
    for j in range(n - m + 1):
        if check(i, j):
            print("Yes")
            return
print("No")

n, m = map(int, input().split())
a, b = [], []
for i in range(n):
  a.append(input())
for i in range(m):
  b.append(input())
  
ans = False
for i in range(n-m+1):
  for j in range(n-m+1):
    flag = True
    for k in range(m):
      if a[i+k][j:j+m] != b[k]:
        flag = False
    if flag:
      ans = True

if ans:
  print("Yes")
else:
  print("No")

import numpy as np
N,M = (int(T) for T in input().split())
A = np.zeros((N,N),dtype=bool)
B = np.zeros((M,M),dtype=bool)
for TN in range(0,N):
    A[TN,:] = [True if T=='.' else False for T in input()]
for TM in range(0,M):
    B[TM,:] = [True if T=='.' else False for T in input()]
MatchFlag = False
for TR in range(0,N-M+1):
    for TC in range(0,N-M+1):
        if np.sum(A[TR:TR+M,TC:TC+M]^B)==0:
            MatchFlag = True
print(['No','Yes'][MatchFlag])

def main():
    n,m = list(map(int,input().split()))
    a,b = [], []
    for i in range(n):
        a.append(input())
    for i in range(m):
        b.append(input())
    for i in range(n-m+1):
        for j in range(n-m+1):
            a_ = []
            for k in range(m):
                a_.append(a[i+k][j:j+m])
            if a_==b:
                print('Yes')
                return
    print('No')

def __starting_point():
    main()

__starting_point()

N, M = map(int, input().split())
A = [''] * N
B = [''] * M
for i in range(N):
    A[i] = input()
for i in range(M):
    B[i] = input()

match_cnt = 0
for i in range(N - M + 1):
    for j in range(N - M + 1):
        flag = True
        for y in range(M):
            if A[y + i][j:j + M] != B[y]:
                flag = False
        if flag:
            match_cnt += 1

if match_cnt > 0:
    print('Yes')
else:
    print('No')

import math
N, M = list(map(int, input().split()))
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]

for i in range(0, math.ceil(N/M)):
    for j in range(0, math.ceil(N/M)):
        # 畳み込み
        flag = True
        for l in range(0, M):
            for m in range(0, M):
                if A[l+i][m+j] != B[l][m]:
                    flag = False
                    break
        if flag == True:
            print("Yes")
            return
print("No")


N,M = map(int,input().split())
A = list(input() for _ in range(N))
B = list(input() for _ in range(M))
ans = "No"
for i in range(N-M+1):
    for j in range(N-M+1):
        if list(k[j:j+M] for k in A[i:i+M]) == B:
            ans = "Yes"
print(ans)



def main():
    n, m = list(map(int, input().split()))
    a = ['' for i in range(n)]
    b = ['' for i in range(m)]
    for i in range(n):
        a[i] = input()
    for i in range(m):
        b[i] = input()
    for i1 in range(n - m + 1):
        for i2 in range(n - m + 1):
            fl = True
            for j in range(m):
                for k in range(m):
                    if a[i1 + j][i2 + k] != b[j][k]:
                        fl = False
            if fl:
                print("Yes")
                return
    print("No")


def __starting_point():
    main()

__starting_point()

n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        if b[0][0] == a[i][j]:
            cnt = 0
            for x in range(m):
                flag = True
                if flag == False:
                    break
                for y in range(m):
                    if b[x][y] == a[i+x][j+y]:
                        cnt += 1
                        pass
                    else:
                        flag = False
                        break
                    if cnt == m**2:
                        print("Yes")
                        return
print("No")

import sys
n,m = map(int,input().split())
la = [input() for _ in range(n)]
lb = [input() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        cnt = 0
        for k in range(m):
            for l in range(m):
                if la[i+k][j+l] == lb[k][l]:
                    cnt += 1
        if cnt == m**2:
            print("Yes")
            return
print("No")

n, m = map(int, input().split())
a_lst = [str(input()) for _ in range(n)]
b_lst = [str(input()) for _ in range(m)]

flag = False
for i in range(n - m + 1):
    for j in range(n - m + 1):

        count = 0
        if a_lst[i][j] == b_lst[0][0]:
            for k in range(m):
                for l in range(m):
                    if a_lst[i + k][j + l] == b_lst[k][l]:
                        count += 1

            if count == m ** 2:
                flag = True

if flag:
    print('Yes')
else:
    print('No')

n,m=map(int,input().split())
a=[list(input()) for _ in range(n)]
b=[list(input()) for _ in range(m)]
r=n-m+1
print('Yes' if any([all([a[x//r+y//m][x%r+y%m]==b[y//m][y%m] for y in range(m**2)]) for x in range(r**2)]) else 'No')

N, M = list(map(int, input().split()))
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
R = list(range(N-M+1))

for i in R:
    for j in R:
        for k in range(M):
            if A[j+k][i:i+M] != B[k]:
                break
        else:
            print('Yes')
            return
print('No')


N, M = list(map(int, input().split()))
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
for y in range(N - M + 1):
    for x in range(N - M + 1):
        matched = True
        for yy in range(y, y + M):
            for xx in range(x, x + M):
                if A[yy][xx] != B[yy - y][xx - x]:
                    matched = False
                if not matched:
                    break
            if not matched:
                break
        if matched:
            print('Yes')
            return
print('No')


n,m = map(int,input().split())
A = [input() for i in range(n)]
B = [input() for i in range(m)]
 
flag = False
for i in range(n-m+1):
    for j in range(n-m+1):
        flag = True
        for k in range(m):
            if B[k] != A[i+k][j:j+m]:
                flag = False
        if flag:
            print("Yes")
            return
print("No")

n,m = list(map(int,input().split()))
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

flag = False
for i in range(n-m+1):

    for s in range(n-m+1):
        if b[0]==a[i][s:s+m]:
            index = s
            cnt = 1
            for j in range(1,m):
                if not a[i+j][index:index+m]==b[j]:
                    break
                cnt+=1
            if cnt==m:
                flag = True
                break


print(("Yes" if flag else "No"))


n,m = map(int,input().split())
A=[]
B=[]
for i in range(n):
    A.append(input())
for i in range(m):
    B.append(input())
cnt=0
flag = False
for i in range(n-m+1):
    for j in range(n-m+1):
        ans = 'Yes'
        for k in range(m):
            for l in range(m):
                if A[i+k][j+l]!=B[k][l]:
                    ans = 'No'
        else:
            if ans == 'Yes':
                print(ans)
                return
print(ans)

import sys
N, M = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
    A.append(input())
for _ in range(M):
    B.append(input())

for i in range(N-M+1):
    for j in range(N-M+1):
        for k in range(M):
            #print(A[i+k][j:j+M])
            #print(B[k])
            if A[i+k][j:j+M] != B[k]:
                break
        else:
            print("Yes")
            return
print("No")



n,m=map(int,input().split())
A = [list(input()) for i in range(n)]
B = [list(input()) for i in range(m)]
for i in range(n-m+1):
  for j in range(n-m+1):
    flag = True
    for k in range(m):
      if A[k+j][i:i+m] != B[k][:]:
        flag = False
        break
    if flag:
      print("Yes")
      return
else:
  print("No")

n,m = [int(x) for x in input().split()]
a = []
for i in range(n):
  a.append(list(input()))
b = []
for i in range(m):
  b.append(list(input()))

res = "No"

for i in range(n-m+1):
  for j in range(n-m+1):
    flag = True
    for k in range(m):
      for l in range(m):
        if a[k+i][l+j] != b[k][l]:
          flag = False
    if flag:
      res = "Yes"

print(res)

n,m=map(int,input().split())
a=[list(input()) for _ in range(n)]
b=[list(input()) for _ in range(m)]
for i in range(0,n-m+1):
    for j in range(0,n-m+1):
        p=[a[x][i:i+m] for x in range(j,j+m)]
        ok=0
        for h in range(m):
            x,y=p[h],b[h]
            for k in range(m):
                if x[k]!=y[k]:
                    ok+=1
        if ok==0:
            print('Yes')
            return
print('No')

import sys, math
from itertools import combinations as c, product as p
from collections import deque
sys.setrecursionlimit(10**9)


def si(): return input()
def ii(): return int(input())
def fi(): return float(input())
def lstr(): return input().split()
def lint(): return list(map(int, input().split()))
def lint_dec(): return list(map(lambda x:int(x) - 1, input().split()))
def lnstr(n): return [input() for _ in range(n)]
def lnint(n): return [int(input()) for _ in range(n)]
def lint_list(n): return [lint() for _ in range(n)]



############################################################
N, M = lint()
A = lnstr(N)
B = lnstr(M)
FLG = False

for i in range(N - M + 1):
    for k in range(N - M + 1):
        if [A[j + k][i:i + M] for j in range(M)] == B:
            FLG = True
            break
    if FLG:
        break
print('Yes' if FLG else 'No')

n,m = map(int, input().split(" "))
a = [list(input()) for i in range(n)]
b = [list(input()) for i in range(m)]
ch = m**2
for i in range(n-m+1):
  for j in range(n-m+1):
    if a[i][j] == b[0][0]:
      count = 0
      for k in range(m):
        for l in range(m):
          #print(i+k, j+l)
          if a[i+k][j+l] == b[k][l]:
            count += 1
      if count == ch:
        print("Yes")
        break
  else:
    continue
  break
else:
  print("No")

N, M = list(map(int, input().split()))
A = []
B = []
for i in range(N):
    A.append(input())
for i in range(M):
    B.append(input())

for i in range(N-M+1):
    if B[0] in A[i]:
        k = A[i].index(B[0])
        points = 1
        for j in range(1,M):
            if B[j] == A[i+j][k:k+M]:
                points += 1
        if points == M:
            print('Yes')
            return
print('No')


def f():
    n, m = map(int, input().split())
    a = [list(input()) for i in range(n)]
    b = [list(input()) for j in range(m)]
    for p in range(n - m + 1):
        for q in range(n - m + 1):
            cnt = 0
            for x in range(m):
                for y in range(m):
                    if a[x+p][y+q] == b[x][y]:
                        cnt += 1
                        if cnt == m*m:
                            return "Yes"
                    else:
                        break
    return "No"
print(f())

#!/usr/bin/env python3

# input = stdin.readline

def solve(n,m,original,temp):
  def judge(sy,sx):
    for i in range(m):
      for j in range(m):
        if original[sy+i][sx+j] != temp[i][j]:
          return False
    return True
  

  sy = 0
  while sy + m - 1 < n:
    sx = 0
    while sx + m - 1 < n:
      if judge(sy,sx):
        return True
      sx += 1
    sy += 1

  return False

def main():
  N,M = list(map(int,input().split()))
  a = [input() for _ in range(N)]
  b = [input() for _ in range(M)]
  print(("Yes" if solve(N,M,a,b) else "No"))
  return

def __starting_point():
  main()

__starting_point()

#!/usr/bin/env python3

def main():
    n, m = list(map(int, input().split()))
    A = [input() for i in range(n)]
    B = [input() for i in range(m)]
    for i in range(n):
        C = []
        p = A[i].find(B[0])
        if p != -1:
            for j in range(m):
                if i + j < n and p + len(B[0]) <= n:
                    C.append(A[i + j][p:p + len(B[0])])
            if C == B:
                break

    print(('Yes' if C == B else 'No'))


def __starting_point():
    main()

__starting_point()

N, M = map(int, input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]
for i in range(N - M + 1):
  pos = -1
  for j in range(A[i].count(B[0])):
    pos = A[i].find(B[0], pos + 1)
    for k in range(1, M):
      if A[i + k].find(B[k], pos) != pos:
        break
    else:
      print('Yes')
      break
  else:
    continue
  break
else:
  print('No')

n, m = list(map(int, input().split()))
A = [input() for _ in range(n)]
B = [input() for _ in range(m)]
for x, a in enumerate(A):
    if x > n - m + 1:
        break
    for i in range(n - m + 1):
        if a[i: i + m] == B[0]:
            for j in range(m):
                if A[x + j][i: i + m] != B[j]:
                    break
            else:
                print("Yes")
                return
print("No")


n,m = map(int,input().split())
a = []
b = []
ans = 0
for i in range(n):
    a.append(list(input()))
for i in range(m):
    b.append(list(input()))
for i in range(n-m+1):
    for j in range(n-m+1):
        cnt = 0
        for s in range(m):
            for t in range(m):
                if b[s][t] == a[s+i][t+j]:
                    cnt += 1
        if cnt == m*m:
            ans = 1
if ans == 0:
    print("No")
else:
    print("Yes")

N,M=list(map(int,input().split()))
A=list(list(input()) for _ in range(N))
B=list(list(input()) for _ in range(M))
flag=False
for i in range(0,N-M+1):
    for j in range(0,N-M+1):
        sub=True
        for x in range(0,M):
            for y in range(0,M):
                if A[i+x][j+y]!=B[x][y]:
                    sub=False
        flag=flag or sub
if flag:
    print("Yes")
else:
    print("No")


N,M = map(int,input().split())
Als = []
Bls = []
ans = 'No'
if Bls == Als:
    ans = 'Yes'
for i in range(N):
    Als.append(input())
for i in range(M):
    Bls.append(input())
for i in range(N-M):
    for j in range(0,N-M):
        for k in range(M):
            if Bls[k] == Als[i+k][j:M+j]:
                ans = 'Yes'
            else:
                ans = 'No'
                break
        if ans == 'Yes':
            break
    if ans == 'Yes':
        break
print(ans)

import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return list(map(int,input().split()))
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

n,m = I()
a = []
b = []

for _ in range(n):
    a += [list(input())]
for _ in range(m):
    b += [list(input())]

for i in range(n-m+1):
    for j in range(n-m+1):
        if [k[j:m+j] for k in a[i:m+i]] == b:
            print('Yes')
            return
print('No')


import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return list(map(int, input().split()))
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

import string

def main():
    N,M = i_map()
    a = [s_input() for _ in range(N)]
    b = [s_input() for _ in range(M)]

    for i in range(N-M+1):
        for j in range(N-M+1):
            flg = True

            for x in range(M):
                for y in range(M):
                    if b[x][y] != a[i+x][j+y]:
                        flg = False
                        break
                if flg == False:
                    break
            if flg == True:
                print("Yes")
                return
    print("No")

def __starting_point():
    main()

__starting_point()

N,M = map(int,input().split())
A = list(input() for _ in range(N))
B = list(input() for _ in range(M))
ans = "No"
for i in range(N-M+1):
    for j in range(N-M+1):
        if [k[j:j+M] for k in A[i:i+M]] == B:
            ans = "Yes"
            """
        for k in A[i:i + M]:
            if k[j:j + M]  == B:
                ans = "Yes"
        """
print(ans)

import sys
N,M=map(int,input().split())
A=[]
for i in range(N):
  a=input()
  A.append(a)
B=[]
for j in range(M):
  b=input()
  B.append(b)
for k in range(N-M+1):
  for l in range(N-M+1):
    z=0
    for m in range(M):
      try:
        if B[m]==A[k+m][l:l+M]:
          z+=1
      except:
        sys.stderr.write(f"{k,l,m}")
        pass
    if z==M:
      print("Yes")
      return
print("No")

N,M = map(int,input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]

ans="No"

for i in range(N-M+1):
    for j in range(N-M+1):
        flag = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l]!=B[k][l]:
                    flag = False
                    break
                    
        if flag:
            ans="Yes"
            break

print(ans)

n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        ans = True
        for k in range(m):
            if b[k] != a[i+k][j:j+m]:
                ans = False
        if ans:
            print("Yes")
            return
print("No")

N,M = map(int,input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]

check = False

for i in range(N-M+1):
  for j in range(N-M+1):
    if A[i][j:j+M] == B[0]:
      flag = True
      for k in range(1,M):
        if A[i+k][j:j+M] != B[k]:
          flag = False
      if flag:
        check = True

print("Yes" if check else "No")

n,m=map(int,input().split())
a=[list(input()) for _ in range(n)]
b=[list(input()) for _ in range(m)]

eq = False
find = False
for i in range(n-m+1):
  for j in range(n-m+1):
    for p in range(m):
      for q in range(m):
        if a[p+i][q+j] == b[p][q]:
          eq = True
        else:
          eq = False
          break
      if not eq:
        break
    if eq:
      find = True
      break
  if find:
    break
if find:
  print('Yes')
else:
  print('No')

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

alist=[input() for _ in range(n)]
blist=[input() for _ in range(m)]

def match(i,j):
    for di in range(m):
        for dj in range(m):
            if alist[i+di][j+dj]!=blist[di][dj]:
                return False 
    return True

for i in range(n-m+1):
    for j in range(n-m+1):
        if match(i,j):
            print("Yes")
            return

print("No")

n,m=map(int,input().split())
a=[list(input()) for i in range(n)]
b=[list(input()) for i in range(m)]
exist=False
for i in range(n-m+1):
  for j in range(n-m+1):
    match=True
    for k in range(m):
      for l in range(m):
        if a[i+k][j+l]!=b[k][l]:
          match=False
    if match:
      exist=True
print("Yes" if exist else "No")

import sys
stdin=sys.stdin

ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
yp=lambda:print('Yes')
np=lambda:print('No')

n,m=lp()
ans=[]
for _ in range(n):
  s=list(sp())
  ans.append(s)

next=[]
for _ in range(m):
  p=list(sp())
  next.append(p)
  
ok=0
count=0
for x in range(n-m+1):
  for y in range(n-m+1):
    ch=0
    for e in range(m):
      for f in range(m):
        if ans[x+e][y+f]==next[e][f]:
          ch+=1
        if ch==m*m:
          ok+=1
  
if ok==0:
  print('No')
else:
  print('Yes')
        
  

N,M=map(int,input().split())
A=[[] for i in range(N)]
B=[[] for i in range(M)]
for i in range(N):
  L=list(input())
  A[i]=L
for i in range(M):
  L=list(input())
  B[i]=L
for i in range(N-M+1):
  for j in range(N-M+1):
    ans=0
    for k in range(M):
      for s in range(M):
        #i,jを始点とした
        if B[k][s]!=A[i+k][j+s]:
          ans=-1
        if k==M-1 and s==M-1:
          if ans==0:
            print("Yes")
            return
print("No")

import sys


N, M = [int(x) for x in input().split()]
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N - M + 1):
    for j in range(N - M + 1):
        found = True
        for _i in range(M):
            for _j in range(M):
                if A[i + _i][j + _j] != B[_i][_j]:
                    found = False
                    break
            if not found:
                break
        if found:
            print('Yes')
            return
print('No')


N,M=map(int,input().split())
A=[input() for i in range(N)]
B=''.join([input() for i in range(M)])
f=0
for i in range(N-M+1):
    for j in range(N-M+1):
        if ''.join([A[l][j:j+M] for l in range(i,i+M)])==B:
            f=1
print(['No','Yes'][f])

N,M = [int(a) for a in input().split()]
A = []
B = []
for i in range(N):
  A.append(input())
for i in range(M):
  B.append(input())  

wa = len(A[0])
wb = len(B[0])
  
matched = False
for i1 in range(N - M + 1):
  for j1 in range(wa - wb +1):
    cnt = 0
    for i2 in range(M):
      #print(B[i2]," vs ", A[i1+i2][j1:j1+wb])
      if B[i2] == A[i1+i2][j1:j1+wb]:
        cnt += 1
    if cnt == M:
      matched = True
      break
          

if matched:
  print("Yes")
else:
  print("No")


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, M = LI()
    A = [SS() for _ in range(N)]
    B = [SS() for _ in range(M)]

    is_ok = False
    for i, j in itertools.product(list(range(N - M + 1)), repeat=2):
        tmp = True
        for k in range(M):
            if B[k] != A[i+k][j:j+M]:
                tmp = False
                break
        if tmp:
            is_ok = True
            break

    if is_ok:
        print('Yes')
    else:
        print('No')

def __starting_point():
    resolve()

__starting_point()

from typing import List


def answer(n: int, m: int, a: List[str], b: List[str]) -> str:
    for i in range(n - m + 1):
        for j in range(n - m + 1):
            if a[i][j:j + m] == b[0]:
                matched_lines = 1
                for k in range(1, m):
                    if a[i + k][j:j + m] == b[k]:
                        matched_lines += 1
                    else:
                        break
                if matched_lines == m:
                    return 'Yes'

    return 'No'


def main():
    n, m = map(int, input().split())
    a = [input() for _ in range(n)]
    b = [input() for _ in range(m)]
    print(answer(n, m, a, b))


def __starting_point():
    main()
__starting_point()

# B - Template Matching
def main():
    n, m = map(int, input().split())

    a_l = [input() for i in range(n)]
    b_l = [input() for i in range(m)]

    for i in range(n-m+1):
        for j in range(n-m+1):
            ans = 'Yes'
            for k in range(m):
                for l in range(m):
                    if a_l[i+k][j+l] != b_l[k][l]:
                        ans = 'No'
            else:
                if ans == 'Yes':
                    print(ans)
                    return
    print(ans)

  
        
def __starting_point():
    main()
__starting_point()

n, m = list(map(int, input().split()))
a = [list(input()) for _ in range(n)]
b = [list(input()) for _ in range(m)]
flag = True
for i in range(n-m+1):
    for j in range(n-m+1):
        flag = True
        for k in range(m):
            for l in range(m):
                if b[k][l] != a[i+k][j+l]:
                    flag = False
                    break
        if flag:
            print('Yes')
            return
print('No')


import numpy

def main():
    n,m=map(int,input().split())
    a=numpy.array([list(input()) for _ in range(n)])
    b=numpy.array([list(input()) for _ in range(m)])
    for i in range(n-m+1):
        for j in range(n-m+1):
            if numpy.all(a[i: i+m, j: j+m] == b):
                print("Yes")
                return
    print("No")
    
def __starting_point():
    main()
__starting_point()

N, M = list(map(int, input().split()))
A = [input() for i in range(N)]
B = [input() for i in range(M)]

for i in range(N - M + 1):  # tate
    for j in range(N - M + 1):  # yoko
        ans = 1
        for k in range(M):
            if B[k] != A[i + k][j:j+M]:
                ans = 0
        if ans == 1:
            print('Yes')
            return
print('No')


n,m = map(int,input().split())
a = [input() for i in range(n)]
b = [input() for j in range(m)]
for i in range(n):
  for j in range(n-m+1):
    tf = 0
    if a[i][j:j+m]==b[0] and i+m<=n:
      tf = 1
      for k in range(i+1,i+m):
        if a[k][j:j+m]!=b[k-i]:
          tf = 0
    if tf:
      print('Yes')
      return
else:
  print('No')

lst = input().split()
N = int(lst[0])
M = int(lst[1])

A = []
B = []

for i in range(N):
   A.append(input())

for i in range(M):
   B.append(input())

if A == B:
   print('Yes')
   return

for x in range(N-M):
   for y in range(N-M):
      count = 1
      for i in range(M):
         if A[y+i][x:x+M] != B[i]:
            count = 0
      if count == 1:
         print('Yes')
         return

print('No')

import numpy

n,m = map(int,input().split())
a = numpy.zeros([n,n], dtype=int)
b = numpy.zeros([m,m], dtype=int)
for i in range(n):
    s = input()
    for j in range(n):
        if s[j] == "#":
            a[i,j] = 1
for i in range(m):
    s = input()
    for j in range(m):
        if s[j] == "#":
            b[i,j] = 1

for i in range(n-m+1):
    for j in range(n-m+1):
        if numpy.all(a[i:i+m, j:j+m] == b):
            print("Yes")
            return
print("No")

n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for j in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if a[k+i][0+j:m+j]!=b[k]:
                break
        else:
            print("Yes")
            break
    else:
        continue
    break
else:
    print("No")

N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
for i in range(N-M+1):
    for j in range(N-M+1):
        flg = True
        for k in range(M):
            for l in range(M):
                flg = flg & (B[k][l] == A[i+k][j+l])
        
        if flg:
            ans = 'Yes'
            print(ans)
            return

ans = 'No'
print(ans)

n, m = map(int, input().split())
A = [input() for _ in range(n)]
B = [input() for _ in range(m)]

ans = 'No'
for i in range(n - m + 1):
    for j in range(n - m + 1):
        if all([A[i + k][j:j + m] == B[k] for k in range(m)]):
            ans = 'Yes'
print(ans)

n, m = list(map(int, input().split()))
A = [list(input()) for _ in range(n)]
B = [list(input()) for _ in range(m)]
ok = False
for ai in range(n-m+1):
    for aj in range(n-m+1):
        match = True
        for bi in range(m):
            for bj in range(m):
                b = B[bi][bj]
                a = A[ai+bi][aj+bj]
                if a == b:
                    continue
                else:
                    match = False
                    break
            if not match:
                break
        else:
            ok = True
        if ok:
            break
    if ok:
        break
print(('Yes' if ok else 'No'))


#
# abc054 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 2
#.#
.#.
#.#
#.
.#"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4 1
....
....
....
....
#"""
        output = """No"""
        self.assertIO(input, output)


def resolve():
    N, M = list(map(int, input().split()))
    A = [list(input()) for _ in range(N)]
    B = [list(input()) for _ in range(M)]

    ans = "No"
    for i in range(N-M+1):
        for j in range(N-M+1):
            ans = "Yes"
            for k in range(M):
                if ans == "No":
                    break
                for l in range(M):
                    if A[i+k][j+l] != B[k][l]:
                        ans = "No"
                        break
            if ans == "Yes":
                break
        if ans == "Yes":
            break

    print(ans)


def __starting_point():
    # unittest.main()
    resolve()

__starting_point()

N,M=map(int,input().split())
A=[input() for i in range(N)]
B=[input() for i in range(M)]
ans = "Yes"
for i in A:
  for j in B:
    if j not in i:
      ans = "No"
print(ans)

n, m = list(map(int, input().split()))
a = [input() for i in range(n)]
b = [input() for i in range(m)]
ans = "Yes"
for i in a:
  for j in b:
    if j not in i:
      ans = "No"
print(ans)


N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
for i in range(N-M+1):
  for j in range(N-M+1):
    flag = True
    AA = [a[j:j+M] for a in A[i:i+M]]
    for a, b in zip(AA, B):
      if a != b:
        flag = False
    if flag:
      print("Yes")
      return
print("No")

N, M = list(map(int, input().split()))
A = []
for _ in range(N):
    a = input()
    A.append(a)

B = []
for _ in range(M):
    b = input()
    B.append(b)

idx = [0, 0]
while True:
    if idx[0] == N - 1 and idx[1] == N - 1:
        break
    if A[idx[0]][idx[1]] == B[0][0]:
        check = False
        for i in range(M):
            for j in range(M):
                if 0 <= idx[0] + i < N and 0 <= idx[1] + j < N:
                    if A[idx[0] + i][idx[1] + j] != B[i][j]:
                        check = True
                        break
                else:
                    check = True
                    break
            if check:
                break

        if not check:
            print('Yes')
            return
    if idx[1] < N - 1:
        idx[1] += 1
        continue
    else:
        idx[0] += 1
        idx[1] = 1
        continue

if A[-1][-1] == B[0][0] and M == 1:
    print('Yes')
    return

print('No')


n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]
ans=False
for i in range(n-m+1):
    for j in range(n-m+1):
        part_a=[a[y][j:j+m] for y in range(i,i+m)]
        cnt=0
        for k in range(m):
            for l in range(n-m+1):
                if (part_a[k][l:m+l]==b[k]):
                    cnt+=1
        if (cnt==m):
            ans=True

if (ans):
    print("Yes")
else:
    print("No")

n,m = map(int,input().split())
a = []
for i in range(n):
  a.append(input())
b = []
for i in range(m):
  b.append(input())
flag = 0
judge = []
for i in range(n-m+1):
  judge = []
  for j in range(n-m+1):
    judge = []
    for k in range(m):
      judge.append(a[i+k][j:j+m])
    if judge == b:
      flag += 1
if flag == 0:
  print("No")
else:
  print("Yes")

import numpy as np
n, m =map(int, input().split())
aa =[list(input()) for i in range(n)]
bb = [list(input())for i in range(m)]
a = np.array(aa)
b = np.array(bb)
for i  in range(n-m+1):
  for j in range(n-m+1):
    
    if (a[i:i+m, j:j+m]==b).all():
      print('Yes')
      return
print('No')

import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    n,m = list(map(int, stdin.readline().rstrip().split()))
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    a = [stdin.readline().rstrip() for _ in range(n)]
    b = [stdin.readline().rstrip() for _ in range(m)]

    for i in range(n-m+1):
        for j in range(n-m+1):
            flag = True
            for h in range(m):
                if a[i+h][j:j+m] != b[h]:
                    flag = False
                    break
            if flag == True:
                print("Yes")
                return
    print("No")






def __starting_point():
    solve()

__starting_point()

N,M=map(int,input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
for i in range(N-M+1):
  for j in range(N-M+1):
    flag=1
    for k in range(M):
      if A[i+k][j:j+M]!=B[k]:
        flag=0
    if flag:
      print("Yes")
      return
print("No")

n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

success = 0
for i in range(n - m + 1):
    fail = 0
    for j in range(n - m + 1):
        fail = 0
        for ii in range(m):
            for jj in range(m):
                if b[ii][jj] == a[i + ii][j + jj]:
                    continue
                else:
                    fail = 1
                    break
            if fail == 1:
                break
        else:
            success = 1
            print('Yes')
            break
    if success == 1:
        break
else:
    if fail == 1:
        print('No')

n,m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for j in range(m)]
res = "No"

if m == 1:
    for i in a:
        if b[0] in i:
            res = "Yes"
else:
    for k in range(n-m+1): # (0,1) ※aの長さを上限にbが縦に移動できる範囲
        if b[0] in a[k]: # もしa[0]かa[1]にb[0]が含まれるなら
            for l in range(n-m+1): # (0,1) ※aの長さを上限にbが横に移動できる範囲
                if b[0] == a[k][l:m+l]: # もし、b[0]がa[0/1][0:2]かa[0/1][1:3]と一致するなら
                    cnt = 0
                    for o in range(m-1): # (0,1) b[0]は一したのでそれ以外
                        if b[o+1] == a[k+o+1][l:m+l]: # b[1/2]がa[]
                            cnt += 1
                    if cnt == m-1:
                        res = "Yes"
        
print(res)

n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
for i in a:
    for j in b:
        if j not in i:
            print('No')
            return
print('Yes')

N, M = map(int, input().split())
A, B = [''] * N, [''] * M
for i in range(N):
    A[i] = input()
for i in range(M):
    B[i] = input()

def check(x, y):
    if x + M > N or y + M > N: return False
    for i in range(M):
        for j in range(M):
            if A[x + i][y + j] != B[i][j]: return False
    return True

for i in range(N):
    for j in range(N):
        if check(i, j):
            print('Yes')
            return
print('No')

import numpy as np
n, m = map(int, input().split())
A = np.array([list(input()) for i in range(n)])
B = np.array([list(input()) for j in range(m)])
for i in range(n-m+1):
    for j in range(n-m+1):
        if np.all(B == A[i:i+m, j:j+m]):
            print("Yes")
            return
print("No")

N,M=map(int, input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]
 
for i in range(N-M+1):
  for j in range(N-M+1):
    t = True
    for k in range(M):
      if B[k] != A[i+k][j:j+M]:
        t = False
    if t:
      print("Yes")
      return
print("No")

n, m=map(int,input().split())
A=[input() for _ in range(n)]
B=[input() for _ in range(m)]

def dfs(y, x):
    for Y in range(m):
        for X in range(m):
            if A[y+Y][x+X]!=B[Y][X]:
                return False
    return True

ans="No"
for y in range(n-m+1):
    for x in range(n-m+1):
        if A[y][x]==B[0][0]:
            if dfs(y,x):
                ans="Yes"
                break
    else:
        continue
    break

print(ans)

n,m = map(int,input().split())
a = ["" for _ in range(n)]
b = ["" for _ in range(m)]
for i in range(n):
  ai = str(input())
  a[i] = ai
for i in range(m):
  bi = str(input())
  b[i] = bi
for i in range(n-m+1):
  for j in range(n-m+1):
    flag = False
    for k in range(m):
      for l in range(m):
        if a[i+k][j+l] != b[k][l]:
          flag = True
          break
      if flag:
        break
    if not flag:
      print("Yes")
      return
print("No")

n ,m = list(map(int, input().split()))
ln = []
lm = []

for i in range(n):
    ln.append(input())
for i in range(m):
    lm.append(input())

lim = n - m + 1
for i in range(lim):
    for j in range(lim):
        l = 0
        for k in ln[i:i+m]:
            if k[j:j+m] != lm[l]:
                break
            l += 1
        else:
            print("Yes")
            break
    else:
        continue
    break

else:
    print("No")


n,m=list(map(int,input().split()))
a=[list(input()) for _ in range(n)]
b=[list(input()) for _ in range(m)]
r=n-m+1
for x in range(r**2):
  for y in range(m**2):
    if a[x//r+y//m][x%r+y%m]!=b[y//m][y%m]:
      break
  else:
    print('Yes')
    break
else:
  print('No')



n,m = map(int,input().split())
A = [input() for i in range(n)]
B = [input() for i in range(m)]

flag = False
for i in range(n-m+1):
    for j in range(n-m+1):
        flag = True
        for k in range(m):
            if B[k] != A[i+k][j:j+m]:
                flag = False
        if flag:
            print("Yes")
            return
print("No")

N,M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

ans = "No"
for i in range(N-M+1):
    for j in range(N-M+1):
        flag = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l] != B[k][l]:
                    flag = False
                    break
        if flag:
            ans = "Yes"
            break
print(ans)

import sys
n, m = list(map(int, input().split()))
a, b = [], []

for _ in range(n):
    a.append(input())
for _ in range(m):
    b.append(input())

for i in range(0, n-m+1):
    for j in range(0, n-m+1):
        for k in range(m*m):
            if a[i+k//m][j+k%m] != b[k//m][k%m]:
                break
            elif k == m*m-1:
                print('Yes')
                return
print('No')


n, m = list(map(int, input().split()))
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

ans = False
for y in range(n-m+1):
    for x in range(n-m+1):
        sol = True
        for h in range(m):
            if a[y+h][x:x+m] != b[h]:
                sol = False
                break

        if sol:
            ans = True
            break
    if ans:
        break

print("Yes" if ans else "No")

N, M = map(int, input().split())
if N < M:
  print('No')
else:
  A = [input() for _ in range(N)]
  B = ''
  cnt = 0
  for _ in range(M):
    B += input().rstrip()
  for i in range(N-M+1):
    if cnt==1:
      break
    for j in range(N-M+1):
      judge = ''
      for k in range(M):
        judge += A[i+k][j:j+M]
      if judge == B:
        cnt += 1
        break
  if cnt == 1:
    print('Yes')
  else:
    print('No')

N, M = list(map(int, input().split()))
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
flag = 0
for i in range(N-M+1):
    for j in range(N-M+1):
        if [line[j:j+M] for line in A[i:i+M]] == B:
            flag = 1
print(('Yes' if flag == 1 else 'No'))



n, m=list(map(int,input().split()))
pic_a = [input() for _ in range(n)]
pic_b = [input() for _ in range(m)]
top = pic_b[0][0]
if m==1:
    for line_a in pic_a:
        for chr_a in line_a:
            if top==chr_a:
                print('Yes')
                return
    print('No')
    return
for i, line_a in enumerate(pic_a[:-m+1]):
    for j, chr_a in enumerate(line_a[:-m+1]):
        if top == chr_a:
            for k, line_b in enumerate(pic_b):
                if line_b != pic_a[i+k][j:j+m]:
                    break
            else:
                print('Yes')
                return
print('No')


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

A = []
for i in range(N):
    A.append(input())

B = []
for i in range(M):
    B.append(input())

for i in range(N-M+1):
    for j in range(N-M+1):
        for k in range(M):
            if A[i+k][j:j+M] != B[k]:
                break
            if k == M-1:
                print("Yes")
                return

print("No")

N, M = map(int, input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]
 
for i in range(N - M + 1):  # tate
    for j in range(N - M + 1):  # yoko
        ans = 1
        for k in range(M):
            if B[k] != A[i + k][j:j+M]:
                ans = 0
        if ans == 1:
            print('Yes')
            return
print('No')

n,m = map(int,input().split())
A=[]
B=[]
for i in range(n):
    A.append(input())
for i in range(m):
    B.append(input())
cnt=0
flag = False
for i in range(n-m+1):
    for j in range(n-m+1):
        ans = 'Yes'
        for k in range(m):
            for l in range(m):
                if A[i+k][j+l]!=B[k][l]:
                    ans = 'No'
        else:
            if ans == 'Yes':
                print(ans)
                return
print(ans)

N, M = map(int, input().split())
A = [''] * N
B = [''] * M
for i in range(N):
    A[i] = input()
for i in range(M):
    B[i] = input()

match_cnt = 0
for i in range(N - M + 1):
    for j in range(N - M + 1):
        flag = True
        for y in range(M):
            for x in range(M):
                if A[y + i][x + j] != B[y][x]:
                    flag = False
        if flag:
            match_cnt += 1

if match_cnt > 0:
    print('Yes')
else:
    print('No')

N,M = map(int,input().split())
A = []
for i in range(N):
    a = list(input())
    A.append(a)
B = []
for i in range(M):
    b = list(input())
    B.append(b)
ans = "No"
for i in range(N-M+1):
    for j in range(N-M+1):
        if A[i][j] == B[0][0]:
            count = 0
            for k in range(M):
                for l in range(M):
                    if A[i+k][j+l] == B[k][l]:
                        count += 1
            if count == M*M:
                ans = "Yes"
                break
print(ans)

n,m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        tnp = 0
        for k in range(m):
            for l in range(m):
                if (a[i+k][j+l]!=b[k][l]):
                    tnp += 1
        if (tnp==0):
            print("Yes")
            return
print("No")

import numpy as np

N,M=map(int,input().split())
A=np.array([list(str(input())) for i in range(N)])
B=np.array([list(str(input())) for j in range(M)])
ans="No"

for i in range(N-M+1):
    for j in range(N-M+1):
        x=[s[j:M+j] for s in A[i:M+i]]
        if np.count_nonzero((x==B)==0) == 0:
            ans="Yes"

print(ans)

N, M = map(int, input().split())
A = []
B = ""
for _ in range(N):
  A.append(input())
for _ in range(M):
  B += input()
for row in range(N-M+1):
  for col in range(N-M+1):
    tmp = ""
    for p in range(M):
      tmp += A[row+p][col:col+M]
    if tmp == B:
      print("Yes")
      return
print("No")

n,m = list(map(int, input().split()))
ma = []
for i in range(n):
  ma.append(input())

t = []
for i in range(m):
  t.append(input())

ans = False
for i in range(n - m + 1):
  for j in range(n - m + 1):
    for k in range(m):
      ll = ma[i + k][j : j + m]
      if ll != t[k]:
        break
    else:
      ans = True

if ans:
  print("Yes")
else:
  print("No")


n,m = map(int, input().split())
a = [[] for _ in range(n)]
b = ""
c = ""
ans = 0
for i in range(n):
  a[i] = list(input())
for j in range(m):
  b += input()
for i in range(n-m+1):
  for j in range(n-m+1):
    for k in range(i,i+m):
      for l in range(j,j+m):
        c += a[k][l]
    if c == b:
      ans += 1
      break
    c = ""
print("Yes" if ans > 0 else "No")

N, M = list(map(int, input().split()))
A = []
B = []
clear = 0
same = 0
for i in range(N):
    A.append(str(input()))
for i in range(M):
    B.append(str(input()))

for i in range(N - M + 1):
    for j in range(N - M + 1):
        same = 0
        for k in range(M):
            if A[i + k][j: j + M] == B[k]:
                same += 1
            else:
                break
        if same == M:
            clear = 1
            break

if clear == 1:
    print('Yes')
else:
    print('No')

        


import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: list(map(int, sys.stdin.readline().split()))
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7


n, m = rm()
a = [rr() for _ in range(n)]
b = [rr() for _ in range(m)] 
for i in range(n-m+1):
    for j in range(n-m+1):
        c = [s[j:j+m] for s in a[i:i+m]]
        if c == b:
            print('Yes')
            return
print('No')





n,m = map(int,input().split())
a = []
b = []
for _ in range(n):
  a.append(input())
for _ in range(m):
  b.append(input())
for i in range(n-m+1):
  if b[i] in a[i]:
    for x in range(m-1):
      if b[i+x] not in a[i+x]:
        print("No")
        return
    print("Yes")
    return
  else:
    print("No")
    return