#include <stdio.h>
int main(){
  long int N,K,count,i,j,con,max,min;
  scanf("%ld %ld",&N,&K);
  count=0;
  for(i=K;i<N+2;i++){
    min=0;
    max=N;
    for(j=1;j<i;j++){
      min=min+j;
      max=max+(N-j);
    }
    con=max-min+1;
    count=count+con;
  }
  count=count%1000000007;
  printf("%ld",count);
  return 0;
}