/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_D&lang=jp
  * Character - Ring
  */
object Main {
  def main(args: Array[String]): Unit = {
    val s = io.StdIn.readLine()
    val p = io.StdIn.readLine()
    if ((s * 2).contains(p))
      println("Yes")
    else
      println("No")
  }
}