#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b;
  if (a - 1 <= b) {
    cout << a - 1 << endl;
    return 0;
  }
  c = b - 1;
  for (int i = 1; i <= a - b; ++i) {
    c += i;
  }
  cout << c << endl;
}
