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

    val res = IntRange(0, l - 1).any {
        i -> IntRange(0, l - 1).all { j -> s[j] == t[(j + i) % l] }
    }

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