import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val s = sc.next
  val t = sc.next

  def solve(head: String, tail: String, sample: String): Boolean = {
    if (head + tail == sample) true
    else if (head.isEmpty) false
    else solve(head.substring(1), tail + head.substring(0, 1), sample)
  }

  println(if (solve(s, "", t)) "Yes" else "No")
}
