import Control.Monad
import Control.Applicative

solve :: [String] -> String
solve [s,p] =
    if (isInfixOf p $ s ++ s) then
        "Yes"
    else
        "No"

main =
    putStrLn =<< solve . lines <$> getContents