import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val s = scanner.nextLine()
    val p = scanner.nextLine()

    println(if ((s + s).contains(p)) "Yes" else "No")
}

