import scala.io.StdIn

object Main extends App {
  val s = StdIn.readLine
  val t = StdIn.readLine

  val sb = StringBuilder.newBuilder
  sb.append(t)
  val len = t.length

  for(i <- 1 to len if (s != sb.toString)) {
    sb.clear
    if(i != len) {
      sb.append(t.substring(len-i))
        .append(t.substring(0,len-i))
      }
  }

  println(if(!sb.isEmpty) "Yes" else "No")
}
