object Main extends App {
  val S = io.StdIn.readLine
  val T = io.StdIn.readLine

  val out = if ((0 to S.size).exists(i => (S.drop(i) ++ S.take(i)).mkString == T)) "Yes" else "No"

  println(out)
}
