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 sl@(s:ss) pl@(p:ps)
        | s == p    = search ss ps
        | pl == t   = search ss t 
        | otherwise = search sl t
                
main :: IO() 
main = do
    l <- getLine
    p <- getLine
    putStrLn $ if solve l p then "Yes" else "No"

