main = do
    s <- getLine
    p <- getLine
    let b = canCreate (s ++ s) p
    putStrLn b

canCreate :: String -> String -> String
canCreate [] _ = "No"
canCreate str@(s:ss) p
    | s == head p = case (equalString str p) of
                        True -> "Yes"
                        False -> canCreate ss p
    | otherwise = canCreate ss p

equalString :: String -> String -> Bool
equalString s p = take (length p) s == p