#include <bits/stdc++.h>
using namespace std;
long long next() {
  long long x;
  cin >> x;
  return x;
}
const long long inf = 1e18, eps = 1e9 + 7, nmax = 2 * 1e5 + 4;
int main() {
  long long n = next(), v = next(), i = 1, ans = 0;
  if (v > n) v = n;
  ans = (n + 1 - v) * (n - v) / 2;
  ans += v - 1;
  cout << ans;
  return 0;
}
