import scala.io.Source

object Main extends App {
  val src: List[String] = Source.stdin.getLines.toList
  val ring: String = src(0) * 2
  val pattern: String = src(1)

  val wordList: List[String] = ring.sliding(pattern.length, 1).toList

  def isIncluded(ws: List[String], pattern: String): Boolean = ws match {
    case Nil => false
    case h :: tail => if (h == pattern) true else isIncluded(tail, pattern)
  }

  if (isIncluded(wordList, pattern)) println("Yes") else println("No")
}