import Control.Applicative

slice from to xs = take (to - from + 1) (drop from xs)

comp nimg' mimg = nimg' == mimg

matSlice nmat nn mm offx offy =
  if (mm + offx) < nn || (mm + offy)
  then []
  else let ys = slice offy (mm offy) nmat
       in slice offx (mm offx) nmat

solve nimg mimg nn mm offx offy
  | (mm + offx) > nn && (mm + offy) > nn = False
  | (mm + offx) <= nn =
      if (matSlice nimg nn mm offy offx) == mimg
      then True
      else solve nimg mimg nn mm (offx + 1) offy
  | (mm + offy) <= nn =
      if (matSlice nimg nn mm offy offx) == mimg
      then True
      else solve nimg mimg nn mm 0 (offy + 1)
  | otherwise = error "error"

main = do
  [m, n] <- words <$> getLine
  nimg <- replicateM (toInt n) getLine
  mimg <- replicateM (toInt m) getLine
  print $ solve nimg mimg n m 0 0
  where
    toInt :: String -> Int
    toInt = read
