import Control.Applicative
import Control.Monad
import Data.Char

find ::String -> String -> Bool
find s p 
  | length s < length p    = False
  | take (length p) s == p = True
  | otherwise              = find (drop 1 s) p

main = do
    s <- getLine
    p <- getLine
    let s' = s ++ take (length p - 1) s
    let o = if find s' p then "Yes" else "No"
    putStrLn $ o
    