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

fun rotateCheck(a: String, b: String): Boolean {
    repeat(a.length) {
        if (a.rotate(it) == b) {
            return true
        }
    }
    return false
}

fun String.rotate(n: Int): String {
    val a = this.substring(0..(this.lastIndex- n))
    val b = this.substring((this.lastIndex - n + 1)..this.lastIndex)
    return b + a
}
