function Main(input){
  input = input.split(" ").map(Number);
  var sum = 0;
  for(var i=input[1];i<=input[0]+1;i++){
      var n = ((input[0]-i+1+input[0])*i/2)-(i*(i-1)/2)+1;
      sum += n;
      sum %=1000000007;
  }
  console.log(sum)
  }Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
