fun main(args: Array<String>) {
    val inputString = readLine()!!
    val pattern = readLine()!!
    if (pattern in inputString + inputString) {
        println("Yes")
    } else {
        println("No")
    }
}

