#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, D;
  cin >> N >> D;
  if (D == 1) {
    cout << N * (N - 1) / 2 << endl;
  } else {
    long long sz = N - (D + 1);
    cout << D + sz * (D + 1) << endl;
  }
}
