main :: IO()
main = do
  s <- getLine
  t <- getLine
  putStrLn $ slv s (t++t)

slv :: String -> String -> String
slv s [] = "No"
slv s t | s == take slen t = "Yes"
        | otherwise = slv s (tail t)
  where slen = length s
