#include <stdio.h>

int main(void)
{
    int N,K;
    long long int max=0, min=0, sum=0;
    scanf("%d %d",&N, &K);

    for(int i=K; i<=N+1; i++){//iは選ぶ数
        //max = 0;
        //min = 0;

        //最小値
        min = (i*(i-1))/2;
        /*for(int j=0; j<i; j++){
            min+=j;
        }*/

        //最大値
        max = (i*(2*N+1-i))/2;
        /*for(int j=N; j>=N+1-i; j--){
            max+=j;
        }*/
        //printf("max=%lld, min=%lld\n",max,min);

        sum += (max-min+1)%1000000007;
        //sum += (i*(N+1-i))%1000000007;
    }


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