module Main where
--import Debug.Trace
import Data.List
import Data.Char
import Data.Array
import Data.Maybe
import Data.Ord
import Control.Monad

solve :: String -> String -> Bool
solve s t = search (s ++ s) t where
    search [] _ = False
    search _ [] = True
    search (s:ss) (p:ps)
        | s == p = search ss ps
        | otherwise = search ss t
                
main :: IO() 
main = do
    l <- getLine
    p <- getLine
    putStrLn $ if solve l p then "Yes" else "No"

