import Data.List (isInfixOf)

main :: IO ()
main = do
  s <- getLine
  t <- getLine
  putStr $ solve s t

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