import Control.Applicative

type Problem = (String, String)

type Result = Bool

solve :: Problem -> Result

solve (s, p)
    = search r p l where
        r = concat $ replicate 2 s
        l = length p
        
search :: String -> String -> Int -> Bool

search s p l
    | length s < l
        = False
        
    | otherwise
        = if all id $ zipWith (==) (take l s) p
            then True
            else search (tail s) p l

output :: Result -> String

output True
    = "Yes"
    
output False
    = "No"
    
input :: IO Problem

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

main :: IO ()

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