#include <bits/stdc++.h>
using namespace std;
queue<int> q;
int main() {
  int i, j, k, l, m, n, cnt = 0, v, sum = 0;
  scanf("%d%d", &n, &v);
  while (cnt < v) {
    q.push(1);
    sum += 1;
    cnt++;
  }
  for (int i = 2; i <= n; i++) {
    cnt--;
    q.pop();
    while (cnt < v) {
      q.push(i);
      sum += i;
      cnt++;
    }
  }
  while (!q.empty()) {
    sum -= q.front();
    q.pop();
  }
  cout << sum << endl;
}
