solve :: String -> String -> Int -> Bool
solve s1 s2 c
  | s1 == s2 = True
  | c <= 0 = False
  | otherwise = solve ((last s1) : init s1) s2 (c - 1)

main = do
  s <- getLine
  n <- getLine
  if(solve s n (length s))
  then putStrLn "Yes"
  else putStrLn "No"