#include<stdio.h>
#include<stdlib.h>
void main(void)
{
  int N,K;
  unsigned long int tmp1=0;
  scanf("%d %d",&N,&K);
  
  for(int i=K;i<=(N+1);i++){
    tmp1=tmp1+i*N-i*i+i+1;

    //tmp1=tmp1%1000000007;
  }
  
  while(tmp1>=1000000007){
    tmp1=tmp1-1000000007;
  }
  printf("%ld",tmp1);
    
  

}