#include <iostream>
using namespace std;

int main() {
	// your code goes here
	
	
	unsigned long long int n,k;
	cin >> n >>k;
	
	
	unsigned long long int minSum, maxSum; 
	unsigned long long ans = 0;
	for(unsigned long long int i = k; i <= n + 1; i++)
	{
		minSum = (i - 1) * i / 2;
		maxSum = ((n * (n + 1)) /2) - (((n - i) * (n - i + 1)) / 2);
		ans += ((((maxSum - minSum)%1000000007) + 1) % 1000000007);
		ans =ans % 1000000007;		
	}
	
	cout << ans;
	
	return 0;
}