module Main where

import Control.Applicative
import Control.Monad

main :: IO ()
main = do
    s <- getLine
    t <- getLine
    let ss = cycle s
    let len = length s
    let rs = fmap (\i -> take len $ drop i ss) [0 .. length s - 1]
    if t `elem` rs
        then putStrLn "Yes"
        else putStrLn "No"