object Main {
  def main(args: Array[String]): Unit = {
    val line = io.StdIn.readLine()
    val target = io.StdIn.readLine()
    val twice = line + line
    val answer =
      if (twice.contains(target)) {
        "Yes"
      } else {
        "No"
      }
    println(answer)
  }
}