import Control.Monad
import Data.Maybe (fromJust)
import Debug.Trace

solve:: Int -> Int -> [String] -> [String] -> Bool
solve x y a b
    | find == True = True
    | y > maxS = False
    | x > maxS = solve 0 (y + 1) a b
    | otherwise = solve (x + 1) y a b
    where
        aLen = length a
        bLen = length b
        maxS = aLen - bLen
        subarea = (take bLen) . (drop maxS)
        aa = subarea (map subarea a)
        find = aa == b

main :: IO ()
main = do
    [n, m] <- map read . words <$> getLine :: IO [Int]
    a <- replicateM n getLine
    b <- replicateM m getLine
    putStrLn $ if (solve 0 0 a b) then "Yes" else "No"