fun main(args: Array<String>) {
    val s = readLine()!!
    val t = readLine()!!

    (0..(s.length - 1))
            .map { (s + s).substring(it, it + s.length) }
            .any { it == t }
            .let { println(if (it) "Yes" else "No") }
}