solve :: String -> String -> Bool
solve s t = t `elem` rotated
  where rotated = [list2 ++ list1 | i <- [0..(length s - 1)], let (list1, list2) = splitAt i s]

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