
object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val s = sc.next()
  val t = sc.next()
  
  val ans = (0 to s.length-1).find(i => s == turn(t, i))
  ans match {
    case Some(_) => println("Yes") 
    case None => println("No") 
  }
  
  def turn(origin: String, cnt: Int): String = {
    var s = origin
    for(i <- 1 to cnt) {
      s = (s.last + s).dropRight(1)
    }
    s
  }
}