#include <stdio.h>

#define lint long long int
#define N_MAX 200001
#define DIV 1000000007


int main()
{
    int n, k;
    scanf("%d %d", &n, &k);
    
    lint cum_sum[N_MAX]; cum_sum[0] = 0;
    for (int i = 1; i <= n; i++) cum_sum[i] = cum_sum[i-1] + i;
    
    lint ans = 0;
    for (int i = k; i < n+1; i++) {
        lint sum = (cum_sum[n]-cum_sum[n-i]) - cum_sum[i-1] + 1;
        ans += sum;
        ans %= DIV;
    }
    
    //i == n+1 の場合は1通りのみ
    ans++;
    ans %= DIV;
    
    printf("%lld\n", ans);
}
