fun main(args: Array<String>) {
    val s = readInputLine().toCharArray()
    val t = readInputLine().toCharArray()
    
    for (i in 0 until s.size) {
        var res = true
        for (j in i until i + s.size) {
            if (s[j % s.size] != t[j - i]) {
                res = false
                break
            }
        }
        if (res) {
            println("Yes")
            return
        }
    }
    
    println("No")
}
 
fun readInputLine(): String {
    return readLine()!!
}
