object Main extends App{
  override def main(args:Array[String])={
    var s = readLine
    var t = readLine
    var len = s.length
    var flag = false
    if(s==t) {
      println("Yes")
      flag=true
    }
    else{
      for(i <- 0 until len if !flag){
      		s = rotation(s)
        	if(s==t) {
              println("Yes")
              flag=true
            }
      }
    }
    if(!flag) println("No")
    
  }
  def rotation(s:String):String={
    var len = s.length
    return s.charAt(len-1)+s.substring(0,len-1)
  }
}
