#include <stdio.h>
#define WARU 1000000007

int main(){
   long i,n,k,kk,m,u,ans;

   scanf("%ld %ld",&n,&kk);
   ans=0;
   for (k=kk;k<=n+1;k++) {
      m=k*(k-1)/2;
      u=(2*n-k+1)*k/2;
      ans=(ans+u-m+1)%WARU;
   }
   printf("%ld\n",ans);
   return 0;
}
