#include <iostream>
#include <cmath>

typedef unsigned long long L_LONG;

int main(){
  const L_LONG mod = 7 + std::pow(10,9);
  
  L_LONG N = 0;
  L_LONG k = 0;
  
  std::cin >> N >> k;
  
  L_LONG sum = 0;
  for(L_LONG cnt = k ; cnt <= N+1 ; cnt++){
    L_LONG big = (cnt*(2*N-cnt+1))/2;
    L_LONG small = (cnt*(cnt-1))/2;
    sum = ( sum + ( big - small + 1 ) ) % mod;
  }
  
  std::cout << sum << std::endl;
  
  return 0;
}