import java.util.*

fun concatenate(a: String, b: String): String{
    return a + b
}
fun rotate(concatenatedString: String, afterRotated:String): String{
    val wordLength: Int = afterRotated.length
    val sameAsAfterRotated = (1..(concatenatedString.length - wordLength)).map{
        it -> concatenatedString.slice(it..(it+wordLength - 1))
    }.filter{
        it == afterRotated
    }
    return if (sameAsAfterRotated.isEmpty()){
        "No"
    } else{
        "Yes"
    }
}

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    val before: String = scn.nextLine()
    val after: String = scn.nextLine()

    val concatenatedString: String = concatenate(before, before)
    println(rotate(concatenatedString, after))
}