#include<stdio.h>
#define mod 1000000007
int main()
{
  long long int n,k;
  scanf("%lld %lld",&n,&k);
  long long int ans=0,min,max;
  for(long long int i=k;i<=n+1;i++)
  {
    min=(i*(i-1))/2;
    max=(n*(n+1))/2-((n+1-i)*(n-i))/2;
    ans+=(max-min+1);
    ans=ans%mod;
  }
  printf("%lld",ans);
}