import scala.io.StdIn

object Main extends App {

  val s = StdIn.readLine()
  val t = StdIn.readLine()

  def solve(i: Int, before: String): Boolean = {
    if (i == t.length + 1) false
    else {
      val rotate = before.tail + before.head
      if (rotate == t) true
      else solve(i + 1, rotate)
    }
  }

  println(if(solve(0, s)) "Yes" else "No")
}
