#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  if (k == n - 1)
    cout << k;
  else if (k >= n)
    cout << n - 1;
  else {
    int x = (n - k);
    x = ((x * (x + 1)) / 2) + (k - 1);
    cout << x;
  }
  return 0;
}
