#include <stdio.h>
#include <stdlib.h>

int main(void) {
    long long int n,k,i;
    long long int ans=0,big,small;
    (void)scanf("%lld %lld",&n,&k);
    for(i=k;i<=n+1;i++){
        big=(i*(2*n-i+1))/2;
        small=(i*(i-1))/2;
        ans+=((big-small+1)%1000000007);
        //ans+=(big-small+1);
    }
    ans=ans%1000000007;
    printf("%lld",ans);
    return 0;
}