#include<stdio.h>

int main(void){
  int N,K; scanf("%d %d",&N,&K);
  int A = 0,B = 0;

  for(int j = K;j <= N+1;j++){
    for(int i = 0;i <= j-1;i++){
      A += N-i;
      B += i;
    }
  }

  printf("%d",(A-B+N-K+2)%1000000007);
  return 0;
}
