import Data.List

data YesNo = Yes | No deriving(Show)

necklace :: String -> String
necklace [] = []
necklace (x:xs) = xs ++ [x]

solver :: String -> String -> Int -> Int -> YesNo
solver s p c n
  | c >= n = No
  | otherwise =
    let s' = necklace s
    in
        if p `isPrefixOf` s'
          then Yes
        else
          solver s' p (c+1) n

main :: IO()
main = do
  s <- getLine
  p <- getLine
  print $ solver s p 0 (length s)