{-# LANGUAGE FlexibleContexts, BangPatterns #-}

module Main where

import Data.Char
import Data.List
import Control.Monad
import Control.Monad.ST
import Data.Array.ST
import Data.Array.Unboxed
import Control.Applicative
import Text.Printf


readInt :: IO Int
readInt = read <$> (input `seq` input)
    where input = do
            !c <- getChar
            if isDigit c || c == '-'
                then (c :) <$> input
                else return []

prints :: Show a => [a] -> IO ()
prints as = putStrLn $ concat $ intersperse " " $ map show as

check s p
  | length s < length p = False
  | otherwise = (and $ zipWith (==) s p) || check (tail s) p

main = putStrLn . f =<< replicateM 2 getLine
  where f [s,p] = if check (s ++ s) p then "Yes" else "No"
