fun main(args : Array<String>) {
    var S = readLine()!!
    val T = readLine()!!

    val length = S.length

    var answer = false

    if (S == T) {
        println("Yes")
        return
    }
    for (i in 1..length) {
        S = S.last() + S.dropLast(1)
        if (S == T) {
            answer = true
            break
        }
    }

    if (answer) {
        println("Yes")
    } else {
        println("No")
    }
}