#include<stdio.h>
#define l 1000000007
int main()
{
    long long N,K,i,sum=0;
    scanf("%lld %lld",&N,&K);
    for(i=K;i<=N+1;i++)

        {
		sum+=(i*((2*N)-i+1))/2-((i*(i-1))/2)+1;	}

printf("%lld\n",sum%l);
    return 0;

}