object Main extends App {
	override def main(args : Array[String]){
		val sc = new java.util.Scanner(System.in)
		val str1,str2 = io.StdIn.readLine
		val message = check(str1,str2) match {
			case true => "Yes"
			case false => "No"
		}
		println(message)
	}
	def check(s1 : String, s2 : String):Boolean = {
		s1.length >= s2.length &&
		(s1+s1).contains(s2)
	}
}