Problem:
 Score : 200 points    Problem Statement 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 1 3 2
#.#
.#.
#.#
#.
.#      Sample Output 1 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 .       Sample Input 2 4 1
....
....
....
....
#      Sample Output 2 No  The template image B , composed of a black pixel, is not contained in the image A composed of white pixels.

Solution (Python):
import sys
N, M = map(int, input().split())

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

for b in range(N-M+1):
    for a in range(N-M+1):
        count = 0
        for i in range(M):
            if B[i] == A[i+b][a:a+M]:
                count += 1
        if count == M:
            print('Yes')
            sys.exit()
    
print('No')

Solution (Python):



def main():
    N, M = map(int, input().split())  
    A = [input() for _ in range(N)]
    B = [input() for _ in range(M)]
    ct = 0
    flag = 0
    ans = 'No'

    

    for B_row in B:
        flag = 0
        for A_row in A:
            if(N-M) == 0:
                if B_row == A_row:
                    ct += 1
                    flag = 1
            else:
                for i in range(N-M):
                    
                    if B_row == A_row[i:M]:
                        ct += 1
                        flag = 1
                        break

            if flag == 1:
                break

    if ct == M:
        ans = 'Yes'

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys

N, M = map(int, input().split())
A = []
B = []

for i in range(0, N):
    Ai = input()
    A.append(Ai)

for i in range(0, M):
    Bi = input()
    B.append(Bi)

found = True
for i_offset in range(0, N-M+1):
    found = True
    j_offset = A[i_offset].find(B[0])
    if j_offset < 0:
        continue
    for i in range(0, M):
        if A[i+i_offset][j_offset:j_offset+M] != B[i][0:M]:
            found = False
            break
    if found:
        print("Yes")
        sys.exit()

print("No")

Solution (Python):
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())
ax = len(a[0])
ay = len(a)
bx = len(b[0])
by = len(b)
ans = False
for i in range(ax - bx + 1):
    for j in range(ay - by + 1):
        flag = True
        for x in range(bx):
            if not flag:
                break
            nx = x + i
            for y in range(by):
                ny = y + j
                if a[nx][ny] != b[x][y]:
                    flag = False
                    break
        if flag:
            ans = True
if ans:
    print("Yes")
else:
    print("No")

Solution (Python):
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):
        for x in range(M):
            if A[j + x][i:i + M] != B[x]:
                break
        else:
            print("Yes")
            exit()
print("No")

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

def match(i,j):
    
    for k in range(M):
        row = A[i+k][j:j+M]
        if row != B[k]:
            return(False)
    return(True)

answer = False
for i in range(N-M+1):
    if answer:
        break
    for j in range(N-M+1):
        if answer:
            break
        if match(i,j):
            answer = True
if answer:
    print('Yes')
else:
    print('No')

Solution (Python):
import numpy as np
n, m = map(int,input().split())
A = []
B = []
for i in range(n):
    a = list(input())
    A.append(a)
for i in range(m):
    b = list(input())
    B.append(b)
A_arr = np.array(A)
B_arr = np.array(B)

for h in range(n-m+1):
    for w in range(n-m+1):
        if np.all(A_arr[h:h+m, w:w+m] == B_arr):
            print("Yes")
            exit()
print("No")

Solution (Python):
n, m = [int(item) for item in input().split()]
a, b = [], []
for i in range(n):
    a.append(input().rstrip())
for i in range(m):
    b.append(input().rstrip())

for i in range(n-m+1):
    for j in range(n-m+1):
        ans = True
        for k in range(m):
            for l in range(m):
                if not a[i+k][j+l] == b[k][l]:
                    ans = False
                    break
        if ans:
            print("Yes")
            exit()
print("No")

Solution (Python):
n,m=map(int,input().split())
A=[list(input()) for i in range(n)]
B=[list(input()) for i in range(m)]
flag=0
for i in range(n-m+1):
  for j in range(n-m+1):
    C=A[i:i+m]
    for k in range(m):
      C[k]=C[k][j:j+m]
    if C==B:
      flag=1
print("Yes" if flag==1 else "No")

Solution (Python):


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):
        c=[a[i+k][j:j+m] for k in range(m)]
        if b==c:
            print('Yes');exit()

print("No")

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n,m = f()
    a = [""] * n
    b = [""] * m
    for i in range(n):
        a[i] = input()
    
    for i in range(m):
        b[i] = input()
    
    if m>n:
        print("No")
    else:
        for i in range(0, n - m+1):
            for j in range(0, n - m+1):
                ok = True
                for k in range(m):
                    if a[i+k][j:j+ m] != b[k]:
                        ok = False
                if ok:
                    print("Yes")
                    return
        
        print("No")


solve()

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    A = [str(input().strip()) for _ in range(N)]
    B = ''
    for _ in range(M):
        B += str(input().strip())

    for i in range(N-M+1):
        for j in range(N-M+1):
            a = ''
            for k in range(M):
                a += A[i+k][j:j+M]

            if a == B:
                return 'Yes'

    return 'No'


if __name__ == '__main__':
    print(main())

Solution (Python):
n,m=map(int,input().split())
arr1=[[i for i in input()] for _ in range(n)]
arr2=[[i for i in input()] for _ in range(m)]
count=0
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 arr1[i+k][j+l]!=arr2[k][l]:
          flag=False
    if flag:
      count+=1
if count>=1:
  print('Yes')
else:
  print('No')

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

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

Solution (Python):
from functools import reduce
import math

def main():
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

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

    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'
                print(ans)
                exit()
            else:
                ans = 'No'


    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
n,m=map(int,input().split())
a_list=[input() for _ in range(n)]
b_list=[input() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        f=True
        for k in range(m):
            for l in range(m):
                if a_list[i+k][j+l]!=b_list[k][l]:
                    f=False
                    break
            if not f:
                break
        if f:
            print("Yes")
            exit()
print("No")

Solution (Python):
n,m=map(int,input().split())

hoge=[]
huga=[]
for i in range(n):
  hoge.append(list(input()))
  
for i in range(m):
  huga.append(list(input()))
ans=0
for i in range(1+n-m):
  for j in range(1+n-m):
    flag=0
    for k in range(m):
      for l in range(m):
        if(hoge[i+k][j+l]!=huga[k][l]):
          flag+=1
    if(flag==0):
      ans+=1
if(ans==0):
  print("No")
else:
  print("Yes")

Solution (Python):
N,M=map(int,input().split())
A=[input() for i in range(N)]
B=[input() for i in range(M)]
flag=0
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
		else:
			flag=1
print('Yes' if flag else 'No')

Solution (Python):
n,m=map(int,input().split())
a=[input() for _ in '1'*n]
b=[input() for _ in '1'*m]
for i in range(n-m+1):
	for j in range(n-m+1):
		c=[a[i+k][j:j+m]for k in range(m)]
		if b==c:print('Yes');exit()
print('No')

Solution (Python):
n,m=map(int,input().split())
a=[input() for _ in '1'*n]
b=[input() for _ in '1'*m];
for i in range(n-m+1):
	for j in range(n-m+1):
		c=[a[i+k][j:j+m]for k in range(m)]
		if b==c:print('Yes');exit()
print('No')

Solution (Python):
import sys
N, M = map(int, input().split())
A = [input() for s in range(N)]
B = [input() for s in range(M)]
for i in range(N - M + 1):
    for j in range(N - M + 1):
        flg = 1
        for x in range(M):
            for y in range(M):
                if B[x][y] !=  A[i+x][j+y]:
                    flg = 0
        if flg == 1:
            print('Yes')
            sys.exit()
print('No')

Solution (Python):
n, m = map(int,input().split())
s = []
for i in range(n):
    s.append(input())
t = []
for i in range(m):
    t.append(input())
found = False
for i in range(0,n-m+1):
    for j in range(0,n-m+1):
        f = True
        for k in range(m):
            for l in range(m):
                if t[k][l] != s[i+k][j+l]:
                    f = False
                    break
        if f == True:
            found = True

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

Solution (Python):

import sys
n,m = map(int, input().split())
a = []
b = []
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):
    flag = True
    for x in range(m):
      for y in range(m):
        if b[x][y] !=  a[i+x][j+y]:
          flag = False
          break
      if not flag:
        break
    else:
      print("Yes")
      sys.exit()
     
    

print("No")

Solution (Python):
import numpy as np

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


flag = False
for i in range(N-M+1):
    for j in range(N-M+1):
        if np.all(A[i:i+M, j:j+M]==B):
            flag = True

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

Solution (Python):
n,m = map(int,input().split())
a_list = [input() for _ in range(n)]
b_list = [input() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        f = True
        for k in range(m):
            for l in range(m):
                if a_list[i+k][j+l] != b_list[k][l]:
                    f = False
                    break
            if not f:
                break
        if f:
            print('Yes')
            exit()
print('No')

Solution (Python):
n,m = map(int,input().split())
a_list = [input() for _ in range(n)]
b_list = [input() for _ in range(m)]
count = 0
res = []
for i in range(n-m+1):
    for j in range(n-m+1):
        f = True
        for k in range(m):
            for l in range(m):
                if a_list[i+k][j+l] != b_list[k][l]:
                    f = False
                    break
            if not f:
                break
        if f:
            print('Yes')
            exit()
print('No')

Solution (Python):
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):
        check = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l] != B[k][l]:
                    check = False
        if check == True:
            ans = 'Yes'
print(ans)

Solution (Python):

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

ans = False

for i in range(n-m):
    for j in range(n-m):
        match = 0
        for k in range(m):
            for l in range(m):
                if a[k+i][l+j] == b[k][l]:
                    match += 1
        if match == m * m:
            ans = True

if n == m:
    match = 0
    for k in range(m):
        for l in range(m):
            if a[k][l] == b[k][l]:
                match += 1
    if match == m * m:
        ans = True

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

Solution (Python):
def do_match(A: list, B: list, offsets: tuple, size_B: int) -> bool:
    oh, ow = offsets
    for h in range(size_B):
        for w in range(size_B):
            if A[oh + h][ow + w] != B[h][w]:
                return False
    return True


def template_matching(N: int, M: int, A: list, B: list) -> bool:
    for offset_h in range(N - M + 1):
        for offset_w in range(N - M + 1):
            if do_match(A, B, (offset_h, offset_w), M):
                return True
    return False


if __name__ == "__main__":
    N = 0
    M = 0
    N, M = map(int, input().split())
    A = [input() for _ in range(N)]
    B = [input() for _ in range(M)]
    yes = template_matching(N, M, A, B)
    print('Yes' if yes else 'No')

Solution (Python):

from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007


"""
def f(n):
    if n == 1:
        return 14
    return n
a,b = LI()
if f(a) < f(b):
    print("Bob")
elif f(a) == f(b):
    print("Draw")
else:
    print("Alice")
"""


n,m = LI()
a = SR(n)
b = SR(m)
for y in range(n-m+1):
    for x in range(n-m+1):
        h = y+m
        w = x+m
        f = 1
        for i in range(y,h):
            for j in range(x,w):
                if a[i][j] != b[i-y][j-x]:
                    f = 0
                    break
            if not f:
                break
        if f:
            print("Yes")
            quit()
print("No")

"""
n,m = LI()
v = LIR(m)
p2 = [1]
for i in range(n):
    p2.append(p2[-1]*2)
dp = [[0 for i in range(p2[n])] for j in range(n)]
dp[0][1] = 1
for i in range(1,p2[n]):
    for k in range(n):
        for a,b in v:
            a -= 1
            b -= 1
            if k==a or k == b:
                c = p2[a]
                d = p2[b]
                if i&c and not i&d:
                    dp[b][i|d] += dp[k][i]
                if (not i&c) and i&d:
                    dp[a][i|c] += dp[k][i]
ans = 0
for i in range(1,n):
    ans += dp[i][-1]
print(ans)
"""


"""
n,p,q = LI()
v = [None for j in range(n)]
sa = 0
sb = 0
for i in range(n):
    a,b,c = LI()
    v[i] = [a,b,c]
    sa += a
    sb += b
dp = [[[float("inf") for i in range(sb+1)] for j in range(sa+1)] for k in range(n+1)]
dp[0][0][0] = 0
for i in range(n):
    for a in range(sa):
        for b in range(sb):
            ai,bi,ci = v[i]
            if a + ai <= sa and b + bi <= sb:
                dp[i+1][a+ai][b+bi] = min(dp[i+1][a+ai][b+bi],dp[i][a][b]+ci,dp[i][a+ai][b+bi])
            dp[i+1][a][b] = min(dp[i+1][a][b],dp[i][a][b])
li = [[p,q]]
while li[-1][0] <= sa and li[-1][1] <= sb:
    li.append([li[-1][0]+p,li[-1][1]+q])
li.pop(-1)
ans = float("inf")
for a,b in li:
    ans = min(ans,dp[n][a][b])
if ans == float("inf"):
    print(-1)
else:
    print(ans)
"""

Solution (Python):
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):
        for k in range(M):
            for l in range(M):
                if a[i + k][j + l] != b[k][l]:
                    break
            else:
                continue
            break
        else:
            print('Yes')
            exit()
print('No')

Solution (Python):
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 = ""
for i in range(N-M+1):

  if B[0] in A[i]:
    ans += "T"
    y = A[i].find(B[0])

    for j in range(1,M):
      
      if A[i+j][y:y+M] == B[j]:
        ans += "T"
      else:
        ans += "F"


if "T" * M in ans:
  print("Yes")
else:
  print("No")

Solution (Python):
N,M=map(int,input().split())
pic=[list(input()) for _ in range(N)]
temp=[list(input()) for __ in range(M)]
flag=0
for i in range(N-M+1):
    if flag==0:
        for j in range(N-M+1):
            if all(pic[x+j][i:i+M]==temp[x] for x in range(M)):
                print("Yes")
                flag=1
                break
if flag==0:print("No")

Solution (Python):
N, M = list(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):
        result = True
        for x in range(M):
            for y in range(M):
                sA = A[i + x][j + y]
                sB = B[x][y]
                if sA != sB:
                    result = False
                    break
            if result is False:
                break

        if result is True:
            print("Yes")
            exit()

print("No")

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

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

result = False
for i in range(N - M + 1):
    for j in range(N - M + 1):
        for k in range(M):
            s1 = A[i + k][j : j + M]
            s2 = B[k]
            if s1 != s2:
                break
        else:
            result = True
            break

if result == True:
    print("Yes")
else:
    print("No")

Solution (Python):
n,m=map(int,input().split())
A=[]
B=[]
for i in range(n):
  a=list(input())
  A.append(a)
for i in range(m):
  b=list(input())
  B.append(b)
for i in range(n-m+1):
  for j in range(n-m+1):
    C=[]
    for k in range(m):
      c=A[k+j][i:i+m]
      C.append(c)
    if B==C:
      print('Yes')
      exit()
print('No')

Solution (Python):
n,m = (int(i) for i in 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):
        flg = True
        for y in range(m):
            for x in range(m):
                if a[i+y][j+x] != b[y][x]:
                    flg = False
                    break
            if flg == False:
                break

        if flg:
            print("Yes")
            exit()

print("No")

Solution (Python):
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):
        for k in range(M):
            for l in range(M):
                if B[k][l] != A[k+i][l+j]:
                    break
            else:
                continue
            break
        else:
            print("Yes")
            break
    else:
        continue
    break
else:
    print("No")

Solution (Python):
n,m=map(int,input().split());a=[input()for i in range(n)];b=[input()for i in range(m)];ans="No"
for i in range(n-m+1):
  for j in range(n-m+1):
    c=[a[i+k][j:j+m]for k in range(m)]
    if b==c:ans="Yes"
print(ans)

Solution (Python):
N,M = map(int,input().split())
A = []
for i in range(N):
    A.append(list(input()))
B = []
for i in range(M):
    B.append(list(input()))
match = 0
for h in range(N-M+1):
    for w in range(N-M+1):
        if A[h][w]==B[0][0]:
            count = 0
            for bh in range(M):
                for bw in range(M):
                    if B[bh][bw]==A[h+bh][w+bw]:
                        count+=1
                    else:
                        count=-1
                        break
                if count==-1:
                    break
            if count==M*M:
                match=1
    if match==1:
        break

if match==0:
    print('No')
else:
    print('Yes')

Solution (Python):
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):
        x=[]
        for k in range(m):
            x.append(a[i+k][j:j+m])
        if x==b:
            print("Yes")
            exit()
print("No")

Solution (Python):
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):
        tmp = []
        for k in range(M):
            tmp.append(A[i+k][j:j+M])
        if tmp == B:
            print("Yes")
            exit()
print("No")

Solution (Python):
def main():
    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):
            ok = True
            for x in range(M):
                for y in range(M):
                    if A[i+x][j+y] != B[x][y]:
                        ok = False
            if ok:
                print("Yes")
                return
    print("No")


if __name__ == "__main__":
    main()

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

ans = "No"

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

Solution (Python):
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 i in range(m)])
ans = 'No'
for i in range(n-m+1):
    for j in range(n-m+1):
        if (a[j:j+m,i:i+m] == b).all():
            ans = 'Yes'
            break
print(ans)

Solution (Python):
N,M=map(int,input().split(' '))
A=[input() for x in range(N)]
B=[input() for x in range(M)]
ans = 'No'
for h in range(0,(N-M)+1):
  for w in range(0,(N-M)+1):
    if sum([B[i]!=A[i+h][w:(w+M)] for i in range(M)])==0:
      ans = 'Yes'
      break
  if ans == 'Yes':
    break
print(ans)

Solution (Python):
N,M = map(int,input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
def ic(x,y):
    for j in range(0,M):
        if B[j] != A[j+y][x:x+M]:return False
    else:return True
def sc():
    for j in range(0,N-M+1):
        for i in range(0,N-M+1):
            if ic(i,j):return True
    else:return False
print('Yes' if sc() else 'No')

Solution (Python):
'''
N, M = map(int, input().split())
A = list(list(input()) for _ in range(N))
B = list(list(input()) for _ in range(M))

ans = 'No'
d = N - M + 1
for i in range(d):
    for j in range(d):
        cnt = 0
        for x in range(M):
            if A[i+x][j:j+M+1] == B[x]:
                cnt += 1
            else:
                break
        if cnt == M:
            ans = 'Yes'
            break
    if ans == 'Yes':
        break

print(ans)
'''
N, M = map(int, input().split())
A = list(list(input()) for _ in range(N))
B = list(list(input()) for _ in range(M))

ans = 'No'
d = N - M + 1
for i_a in range(d):
    for j_a in range(d):
        cnt = 0
        for i_b in range(M):
            for j_b in range(M):
                if A[i_a + i_b][j_a + j_b] == B[i_b][j_b]:
                    cnt += 1
                else:
                    break
            
        if cnt == M**2:
            ans = 'Yes'
            break
    if ans == 'Yes':
        break

print(ans)

Solution (Python):
'''
N, M = map(int, input().split())
A = list(list(input()) for _ in range(N))
B = list(list(input()) for _ in range(M))

ans = 'No'
d = N - M + 1
for i in range(d):
    for j in range(d):
        cnt = 0
        for x in range(M):
            if A[i+x][j:j+M+1] == B[x]:
                cnt += 1
            else:
                break
        if cnt == M:
            ans = 'Yes'

print(ans)
'''
N, M = map(int, input().split())
A = list(list(input()) for _ in range(N))
B = list(list(input()) for _ in range(M))

ans = 'No'
d = N - M + 1
for i_a in range(d):
    for j_a in range(d):
        cnt = 0
        for i_b in range(M):
            for j_b in range(M):
                if A[i_a + i_b][j_a + j_b] == B[i_b][j_b]:
                    cnt += 1
                else:
                    break
            
        if cnt == M**2:
            ans = 'Yes'
            break
    if ans == 'Yse':
        break

print(ans)

Solution (Python):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
flag = False

for i in range(0, N-M+1):
    for j in range(0, N-M+1):
        sample = []
        for k in range(M):
            sample.append(A[i+k][j:j+M])
        if sample == B:
            flag = True
            break
   
print("Yes" if flag else "No")

Solution (Python):
N, M = [ int(x) for x in input().split() ]
As = [ input() for _ in range(N) ]
Bs = [ input() for _ in range(M) ]

def contain(i, j):
    for p in range(M):
        if As[i + p][j:j+M] != Bs[p]:
            return False
    return True
ans = False
for i in range(N - M + 1):
    for j in range(N - M + 1):
        if contain(i, j):
            ans = True

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

Solution (Python):
n,m=(int(i) for i in input().split())

a=[]
for i in range(n):
    a.append(input())

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

flag=0

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

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

for x in range(n-m+1):
    for y in range(n-m+1):
        check = 0
        for i in range(m):
            for j in range(m):
                if a[x+i][y+j] != b[i][j]:
                    check = 1
                    break
            else:
                continue
            break
        if check == 0:
            print('Yes')
            exit()

print('No')

Solution (Python):
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):
        s = [a[j:j+m] for a in A[i:i+m]]
        if s == B:
            print('Yes')
            exit()
print('No')

Solution (Python):
N,M=map(int,input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
flag=False
for y in range(1+N-M):
    if flag==True:break
    for x in range(1+N-M):
        if flag==True:break
        check=True
        for i in range(M):
            if check==False:break
            for j in range(M):
                if check==False:break
                if A[y+j][x+i]!=B[j][i]:
                    check=False
                    break
        if check==True:
            flag=True
            break
if flag==True:print('Yes')
else:print('No')

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

for i in range(N-M+1):
    for j in range(N-M+1):
        sub_A = [a[j:j+M] for a in A[i:M+i]]
        if sub_A == B:
            print('Yes')
            exit()

print('No')

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

Solution (Python):
N, M = list(map(int, input().split()))
picture = [input() for i in range(N)]
template = [input() for i in range(M)]

for i in range(N - M + 1):
    for j in range(N - M + 1):
        subpicture = [picture[row][j:j + M] for row in range(i, i + M)]
        if subpicture == template:
            print('Yes')
            break
    else:
        continue
    break
else:
    print('No')

Solution (Python):
n,m=[int(i) for i in input().split()]
a=[input() for i in range(n)]
b=[input() for i in range(m)]
result=True
for i in range(m):
    if (b[i] in a[i])==False:
        result=False
        break
print("Yes" if result else "No")

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

start=-1
for i in range(N):
    if B[0] in A[i]:
        start=i
        break
if start==-1 or start+M>N:
    print('No')
    exit()
else:
    for i in range(M):
        if (B[i] in A[start+i])!=1:
            print('No')
            exit()

print('Yes')

Solution (Python):
n, m = map(int, input().split())
aa = [input() for _ in range(n)]
bb = [input() for _ in range(m)]

match = False
for y in range(n-m+1):
    for x in range(n-m+1):
        target = ([''.join(aa[i][x:x+m]) for i in range(y, y+m)])
        if match or target == bb:
            match = True

print('Yes' if match else 'No')

Solution (Python):
N,M = map(int,input().split())
A = []
A_portion = []
B = []
judge = 0

if(N < M):
  print('No')
else:
 for i in range(N):
   a = input() + '?'*(M)
   A.append(list(a))
 for i in range(M):
   list_dummy = list('?'*(len(a)))
   A.append(list_dummy)
  
 for i in range(M):
   b = input()
   B.append(list(b))

 for i in range(N):
  for j in range(N):
   for k in range(M):
    A_portion.append(A[j+k][i:i+M])
   
   
   if(A_portion == B):
     judge = 1
   A_portion = []
    
 if(judge == 1):
   print('Yes')
 else:
   print('No')