import Data.List

main = do
    as <- getLine
    bs <- getLine
    let n = 100 `div` (length as)
        ass = concat $ replicate n as
     in case (bs `isInfixOf` ass) of
        True  -> putStrLn "Yes"
        False -> putStrLn "No"
