#include<stdio.h>

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

  for(long long int i = K;i <= N+1;i++){
    A += N*i - i*i + i + 1;
  }

  printf("%lld",A%1000000007);
  return 0;
}
