import scala.io.StdIn._

object Main {
  def isMakeText(r: String, t: String): String = {
    val l = t.length

    def loop(n: Int = 0): String ={
      if(n < r.length - l) {
        val mkText = (for (i <- n until l + n) yield r(i)).mkString("")
        if (mkText == t) "Yes" else loop(n + 1)
      } else "No"
    }

    loop(0)
  }

  def main(args: Array[String]): Unit = {
    val ring = readLine() * 2
    val text = readLine()
    println(isMakeText(ring, text))
  }
}