import Control.Applicative
import Control.Monad
import Data.Array
import Data.Array.ST
import Data.Char
import Data.List
import qualified Data.Map as M
import qualified Data.Set as S
import Text.Printf

readInts :: IO [Int]
readInts = map read . words <$> getLine

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

solve :: String -> String -> Bool
solve s p = p `isInfixOf` (s ++ s)

