import java.util.Scanner;
object Main {
  def main(args: Array[String]): Unit = {
    var sc = new Scanner(System.in)
    var s = sc.next * 2
    var p = sc.next
    println(if(s.contains(p)) "Yes" else "No")
  }
}