{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Data.Sequence (Seq, ViewL ((:<)), (|>))
import qualified Data.Sequence as Seq

main :: IO ()
main = do
  s <- getLine
  t <- getLine
  putStrLn $ if solve s t then "Yes" else "No"

solve :: String -> String -> Bool
solve s t = any (== t') . take n $ iterate rotate s' where
  s' = Seq.fromList s
  t' = Seq.fromList t
  n = Seq.length s'

rotate :: Seq a -> Seq a
rotate xs = ys |> y where
  y :< ys = Seq.viewl xs
