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

fun canMatch(s:String, t:String):Boolean {
    if(s == t) {
        return true
    }
    for(i in (1 .. s.length)) {
        if(s.substring(i) + s.substring(0 until i) == t) {
            return true
        }
    }
    return false
}