import qualified Data.List as List

main = do
    s <- getLine
    p <- getLine
    putStrLn $ if elemFromRing (List.elemIndices (head p) s) s p then "Yes" else "No"

elemFromRing :: [Int] -> String -> String -> Bool
elemFromRing [] _  _ = False
elemFromRing (x:xs) s p
    | pickFromRing [x..(x + length p - 1)] s == p = True
    | otherwise                                   = elemFromRing xs s p

pickFromRing :: [Int] -> String -> String
pickFromRing [] _ = []
pickFromRing (n:ns) xs = xs !! (n `mod` length xs) : pickFromRing ns xs