#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n, k;
  cin >> n >> k;
  int cnt = min(n - 1, k);
  int a = n - cnt;
  cnt += (a * (a + 1)) / 2 - 1;
  cout << cnt << endl;
  return 0;
}
