object Main extends App {
  val scanner = new java.util.Scanner(System.in)

  val s = scanner.nextLine()
  val p = scanner.nextLine()

  val ss = s ++ s

  val output = ss.contains(p)

  println(if(output) "Yes" else "No")
}