program template_matching
  implicit none
  character(50) :: s
  integer :: n, m, a(50,50) = 0, b(50,50) = 0, i, j
  read(*,*) n, m
  do i = 1, n
    read(*,*) s
    s = trim(adjustl(s))
    do j = 1, n
      if (s(j:j) == "#") a(i,j) = 1
    end do
  end do
  do i = 1, m
    read(*,*) s
    s = trim(adjustl(s))
    do j = 1, m
      if (s(j:j) == "#") b(i,j) = 1
    end do
  end do
  do i = 1, n-m+1
    do j = 1, n-m+1
      if (sum(abs(a(i:i+m-1,j:j+m-1)-b(1:m,1:m))) == 0) then
        write(*,'(a)') "Yes"
        stop
      end if
    end do
  end do
  write(*,'(a)') "No"
  stop
end program template_matching