import java.util.*

val sc = Scanner(System.`in`)
var S: String = sc.next()
val T: String = sc.next()

fun main(args: Array<String>) {
    var flg = false
    repeat(T.length + 1) {
        if (S == T) {
            flg = true
            return@repeat
        }
        S = S.substring(1) + S[0]
    }
    println(if (flg) "Yes" else "No")
}
