#include <bits/stdc++.h>
using LL = long long;
using namespace std;
const int mod = 1e9 + 7;
int main() {
	int n, k; cin >> n >> k;
	LL pre_sum[n + 1] = {};
	int a[n + 1] = {};
	iota(a, a + n + 1, 0);
	for (int i = 1; i <= n; i++) {
		pre_sum[i] = pre_sum[i - 1] + a[i];
	}
	LL sum = 1;
	for (int i = 2; i <= n; i++) {
		sum = (sum + pre_sum[n] - pre_sum[n - i] - pre_sum[i - 1] + 1) % mod;
	}
	cout << sum;
}