#include<iostream>
using namespace std;
int main(){
int N, K;
cin >> N;
cin >> K;
long long s = 0;
for (int i = K ; i <= N +1; ++i){
s += i*(N -i +1) +1;
  s = s % 1000000007;
}
  cout << s << endl;
}
