#include<stdio.h>

long sum(int n){
  long a = n*(n+1)/2;
  return a;
}

long ssum(int n,int k){
  long a=(2*n-k+1)*k/2;
  return a;
}

int main(){
  int n,k;
  int mod=1000000007;
  scanf("%d%d",&n,&k);
  int i;
  long ans=0;
  for(i=k;i<=n+1;i++){
    ans += ssum(n,i)+1-sum(i-1);
    ans = ans%mod;
    //printf("%ld %ld %ld\n",ans,ssum(n,i),sum(i-1));
  }
  printf("%ld\n",ans);
}
