fun main(args: Array<String>) {
    abc103b()
}

fun abc103b() {
    val s = readLine()!!
    val t = readLine()!!

    val answer = (0..s.length).any {
        val rotated = s.takeLast(it) + s.take(s.length - it)
        rotated == t
    }.let { if (it) "Yes" else "No" }

    println(answer)
}
