import qualified Data.ByteString.Char8 as BS
import Data.Maybe (isNothing, fromJust)

main :: IO ()
main = do
  [n,m] <- map (read . BS.unpack) . BS.words <$>  BS.getLine :: IO [Int]
  nsq <- BS.lines <$> BS.getContents :: IO [BS.ByteString]
  msq <- BS.lines <$> BS.getContents :: IO [BS.ByteString]
  if find (n, nsq) (m, msq) then putStr "Yes" else putStr "No"


getFirst :: (Int, BS.ByteString) -> (Int, BS.ByteString) -> Int -> Maybe Int
getFirst (nlen,nline) (mlen,mline) acc
  | BS.length nline < mlen = Nothing
  | otherwise = if t == mline then
                            Just acc
                              else
                            getFirst (nlen, BS.tail nline) (mlen, mline) (acc+1)
  where t = BS.take mlen nline

getRest :: [BS.ByteString] -> [BS.ByteString] -> Int -> Bool
getRest ns ms acc = 
  Prelude.foldr (\(n, m) b -> (n == m) && b) True z 
  where z = zip (map (BS.drop acc) ns) ms

find :: (Int, [BS.ByteString]) -> (Int, [BS.ByteString]) -> Bool
find (nlen, ns) (mlen, ms) 
  | ns == mempty = False
  | otherwise = if isNothing fn then
                                  find (nlen, tail ns) (mlen, ms)
                                  else
                                  if getRest (tail ns) ms (fromJust fn) then
                                                                        True
                                                                        else
                                                                        find (nlen, tail ns) (mlen, ms)

    where nFirst = head ns
          mFirst = head ms                
          fn = getFirst (nlen, nFirst) (mlen, mFirst) 0


                                                              




