fun main(args:Array<String>){
    val str1 = readLine()?:""
    val str2 = readLine()?:""
    var str = str2
    for(i in 0 .. str.length-1){
        str = str + str2[i]
        str = str.substring(1,str2.length+1)
        if(str1.equals(str,true)) {
            println("Yes")
            return
        }
    }
    println("No")
}