import           Control.Applicative
import           Control.Monad
import           Data.List

main :: IO ()
main = do
    s <- getLine
    p <- getLine
    if p `isInfixOf` (s ++ s)
       then putStrLn "Yes"
       else putStrLn "No"

