#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int		main(void)
{
	int N, K;
	cin >> N >> K;
	ll ans = 0;
	vector<ll> R(N+1);
	R[0] = 0;
	for (ll i = 1; i < N+1; i++)
		R[i] = R[i-1] + i;
	for (int i = K; i <= N+1; i++)
	{
		ll mn = R[i-1];
		int idx = max(0, N-i);
		ll mx = R[N] - R[idx];
		ans += (mx - mn + 1);
	}
	cout << ans << endl;
}

