fun main(args: Array<String>) {
    val s = readLine() ?: ""
    val t = readLine() ?: ""
    val l = s.length

    var flag = false
    for (i in 0..(l - 1)) {
        for (j in 0..(l - 1)) {
            if (s[j] != t[(j + i) % l]) {
                break
            }

            if (j == l - 1) {
                flag = true
            }
        }
    }

    println(if (flag) "Yes" else "No")
}