
fun main(arr:Array<String>) {
    val ans = rotate(readLine()!!, readLine()!!)
    println(if(ans) "Yes" else "No")
}

fun rotate(txt:String, target:String):Boolean {
    if(txt == target) {
        return true
    }
    for(i in (1 until txt.length)) {
        val tmp = txt.substring(i) + txt.substring(0 until i)
        if(tmp == target) {
            return true
        }
    }
    return false
}