#include<stdio.h>
#define NUM 1000000007
typedef long long ll;
ll sum(ll begin,ll end){
    return (begin + end) * (end - begin + 1)/2;
}
int main(){
    ll N,K;
    scanf("%lld %lld",&N,&K);
    ll ans = 0;
    for(ll i=K;i<=N+1;i++){
        ans += sum(N-(i-1),N) - sum(0,i-1) + 1;
        ans %= NUM;
    }
    printf("%lld",ans);
}
