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) where
    search [] = False
    search ss 
        | take lenT ss == t = True
        | otherwise = search (tail ss)
    lenT = length t
                
main :: IO() 
main = do
    l <- getLine
    p <- getLine
    putStrLn $ if solve l p then "Yes" else "No"

