import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val n, k = sc.nextLong()
    val Mod = math.pow(10, 9).toLong + 7
    var ans = 0L
    for (i <- k to n + 1) {
      val min = (0L + i - 1L) * i / 2L
      val max = (n + n - i + 1L) * i / 2L
      ans = (ans + (max - min + 1)) % Mod
    }

    println(ans % Mod)
  }

}
