#include<stdio.h>
int main(void){
  long long int n,k,i,a,b,c;
  c=0;
  scanf("%lld %lld",&n,&k);
  for(i=k;i<=n+1;i++){
    a=n*i-(i*(i-1)/2);
    b=i*(i-1)/2;
    c+=a-b+1;
    c%=1000000007;
  }
  printf("%lld\n",c);
  return 0;
}
