import Control.Applicative

import Data.List
    (isInfixOf)

type Problem = (String, String)

type Result = Bool

solve :: Problem -> Result

solve (s, p)
    = isInfixOf p (s ++ s)

output :: Result -> String

output bool
    = if bool then "Yes" else "No"
    
input :: IO Problem

input
    = do
        s <- getLine
        p <- getLine
        return (s, p)

main :: IO ()

main
    = putStrLn.output =<< solve <$> input