#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, v;
  int cur = 0, cost = 0;
  cin >> n >> v;
  for (int i = 0; i < (n - 1); i++) {
    if (cur < (n - i - 1)) {
      if ((n - i - 1 - cur) >= (v - cur)) {
        cost += ((i + 1) * (v - cur));
        cur += (v - cur);
      } else {
        cost += (i + 1) * (n - i - 1 - cur);
        cur += (n - i - 1 - cur);
      }
    }
    cur--;
  }
  cout << cost << "\n";
  return 0;
}
