import Data.Bool (bool)
import Data.List (isInfixOf)

main :: IO ()
main = putStr
  =<< solve <$> getLine <*> getLine

solve :: String -> String -> String
solve s t = bool "No" "Yes" $ s `isInfixOf` (t ++ t)
  
