import Data.List

main = interact $ show' . solve . read'
  where
    show' True = "Yes\n"
    show' False = "No\n"
    solve [xs, ys] = solve' $ xs ++ xs'
      where
        solve' ss | length ss < lys = False
                  | isPrefixOf ys ss = True
                  | otherwise = solve' $ tail ss
        (xs', _) = splitAt lys xs
        lys = length ys
    read' = lines

