#include<stdio.h>

#define MOD_N 1000000007
#define MAX_N 200001

int main(void){
    int N,K;
    long int sum[MAX_N+1],ans=0,min,max,i;

    scanf("%d %d",&N,&K);
    sum[0];
    for(i = 1;i <= N;i++){
        sum[i] = i;
        sum[i] += sum[i-1];
    }

    for(i = K;i <= N+1;i++){
        min = sum[i-1];
        if(i == N+1) max = sum[N];
        else max = sum[N] - sum[N-i];
        ans += max - min + 1;
    }

    printf("%ld\n",ans % MOD_N);
    return 0;
}