main :: IO ()
main = do
  s <- getString
  t <- getString
  let n = length s
  putStrLn $ if t `elem` [take n . drop x . cycle $ s | x <- [0..n-1]] then "Yes" else "No"

getString :: IO String
getString = getLine
