import Data.List
main=do
    s<-getLine
    t<-getLine
    let n = length s
    putStrLn $ case (find (==t) $ map (rot s) [0..n-1]) of
        Just _ -> "Yes"
        Nothing -> "No"

rot s n = drop n s ++ take n s