#include <stdio.h>

#define LIMIT 1000000007
typedef long long LL;

LL summin(LL k){
    //0~k-1の和
    LL ans = (k-1)*k%LIMIT;
    ans /= 2;
    //printf("summin(%ld) = %ld\n", k, ans);
    return ans;
}

LL summax(LL k, LL max){
    //~max,k項の和
    LL ans = 2*max%LIMIT;
    ans = (ans-k+1)%LIMIT;
    ans = ans*k%LIMIT;
    ans /= 2;
    //printf("summax(%ld, %ld) = %ld\n", k, max, ans);
    return ans;
}

int main(){
    LL N, K;
    scanf("%lld%lld", &N, &K);
    LL ans = 0, buf;
    for(LL k=K; k<=N+1; k++){
        buf = summax(k, N) - summin(k) + 1;
        buf %= LIMIT;
        ans += buf;
        ans %= LIMIT;
    }
    printf("%lld\n", ans);
    return 0;
}