#include<stdio.h>
#include<math.h>

int main(void){
    int N;
    int K;

    long long int answer=0;
    //入力部分
    scanf("%d%d",&N,&K);

    //計算部分
    for(int k = K; k <= N+1; k++){
        answer += ((N+N-k+1)*k/2)-((k-1)*k/2)+1;
    }

    //出力部分
    printf("%lld\n",answer%1000000007);
}