#include<stdio.h>

int main(){
  int N,K;
  long M,m,sum=0;
  scanf("%d%d",N,K);
  for(long a=K;a<=N+1;a++){
   m=a*(a-1)/2;
   M=a*(2*N-a+1)/2;
   sum+=M-m;
  };
  printf("%ld",sum%1000000007);
};
  
   
  
    