#include "stdio.h"
#define mod 1000000007

int main(void)
{
  int n;
  int k;
  int i,j;
  scanf("%d",&n);
  scanf("%d",&k);
  long kei=0;
  long min=0;
  long max=0;

  for(i=0;i<k;i++)
  {
    min = min + i;
    max = max + (n-i);
  }
  kei = (max-min)+1;

  for(j=k;j<=n;j++)
  {
    min =min + j;
    max =max + (n-j);
    kei = kei+ (max - min) + 1;
  }

  printf("%ld",kei%mod);
}