#include<stdio.h>
#define mod 1000000007
#define ll long long 
int main(){
    ll n, k, ans = 0;
    scanf("%lld%lld",&n,&k);
    for(; k <= n + 1; k++){
        ans += (n - k + 1) * k + 1;
        ans %= mod;
    }
    printf("%lld\n",ans);
    return 0;
}