#include <stdio.h>
#define mod 1000000007

int main(){

    int N, K;
    scanf("%d %d", &N, &K);

    int i;
    long long int fi, la, answer = 0;

    for(i = K; i <= N+1; i++){
        fi = i*(i-1)/2%mod;
        la = (N*(N+1)/2)%mod-((N-i)*(N-i+1)/2)%mod;
        answer += la-fi+1;
    }
    printf("%lld",answer%mod);

   return 0;
}