/*
 * FileName:     D
 * CreatedDate:  2020-04-19 20:58:20 +0900
 * LastModified: 2020-04-19 22:15:22 +0900
 */

#include <stdio.h>

int main(void){
    long int n,k;
    scanf("%ld %ld",&n,&k);
    long int count=0;
    long int down=0,up=0;
    for(long int i=k;i<n+2;i++){
        down=(i-1)*i/2;
        up=n*i-down;

        count+=up-down+1;
        count=count%1000000007;
    }
    printf("%ld\n",count%(1000000007));
    return 0;
}
