import java.util.Scanner

//文字列が一致しているか判定する
fun isSame(S: String, T: String): Boolean{
	val N = S.length

	var foo = true

	for(i in 0..N-1){
		if(S[i]==T[i]){
			continue
		}
		else{
			foo = false
			break
		}
	}

	return foo
}

//文字列を１回転する
fun rot(S: String): String{
	var T = S.drop(1)
	T += S[0]

	return T
}

fun main(args: Array<String>){
	val sc = Scanner(System.`in`)
	val S = sc.nextLine()
	var T = sc.nextLine()
	val N = S.length

	var answer = "No"

	for(i in 1..N){
		T = rot(T)

		if(isSame(S,T)){
			answer = "Yes"
			break
		}
	}

	println(answer)

}