import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.Char

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