#include <bits/stdc++.h>
using namespace std;
int n, v, ans1, w, ans2, kfjdsaljfalk;
string skldgflakdjdlsa;
int main() {
  cin >> n >> v;
  for (int i = 1; i <= 5; i++) kfjdsaljfalk++;
  for (int i = 1; i <= 5; i++) kfjdsaljfalk++;
  for (int i = 1; i <= 5; i++) kfjdsaljfalk++;
  for (int i = 1; i <= 5; i++) kfjdsaljfalk++;
  for (int i = 1; i <= 5; i++) kfjdsaljfalk++;
  for (int i = 1; i <= n; i++) {
    if (w != v && n - i > w) {
      while (w != v && w < n - i) {
        ans1 += i;
        w++;
        if (w == v || w >= n - i) {
          ans2++;
          break;
        }
      }
    }
    w--;
  }
  for (int i = 1; i <= 5; i++) kfjdsaljfalk++;
  cout << ans1 << endl;
}
