main = do
    s <- getLine
    t <- getLine
    let ans = any (== t) $ rotateAll s
    putStrLn $ if ans then "Yes" else "No"

rotate :: Int -> [a] -> [a]
rotate _ [] = []
rotate n xs = zipWith const (drop n (cycle xs)) xs

rotateAll :: [a] -> [[a]]
rotateAll [] = []
rotateAll xs = map (\n -> rotate n xs) [0..(length xs) - 1]
