import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  s <- getLine
  t <- getLine
  let s' = zip [1..length s] s
  putStrLn $ rotation s' t
  
rotation s' t
  |rots==t   = "Yes"
  |rotn==1   = "No"
  |otherwise = rotation rot t
    where rot = last s' : init s'
          rots = map snd rot
          rotn = fst $ head rot