#include<stdio.h>
#include<math.h>
#include <string.h>


int main() {
	long long int i, j, k;
	long long int m, g = 0, n, q, b, c, d, e;
	long long int f = 0;

	scanf("%lld %lld", &n, &k);

	f = 1;
	for (i = 1;;i++) {
		if (k == (n + 2 - i)) {
			break;
		}
		g = i + n;
		if (g > ((n*(n + 1)) / 2) + 2 - i) {
			f = f + ((n*(n + 1)) / 2) + 2 - i;
		}
		else {
			f = f + g;
		}

		if (f > 1000000007) {
			f = f - 1000000007;
		}

		printf("%lld\n", f);
	}

	
	printf("%lld\n", f);
	

	

	return 0;
}