import scala.io.StdIn._

object Main extends App {
  val s = readLine()
  val t = readLine()
  var u = s

  val r =
    if ((1 to t.length).exists { _ =>
          val b = u == t
          u = u.last + u.init
          b
        })
      "Yes"
    else
      "No"

  println(r)
}
