

fun main(args : Array<String>){
    val A = readLine()!!
    val B = readLine()!!

    for(i in 0 until A.length){
        var flag = true
        for(j in 0 until A.length){
            if(A[j] != B[(i+j) % A.length])flag = false
        }
        if(flag){
            println("Yes")
            return
        }
    }
    println("No")

}
