#include <bits/stdc++.h>
using namespace std;
int n, m;
long long ans = 0;
inline bool chk(int x, int y, int z, int xx) {
  return 2 * x * xx - xx * y - (x + y) * z > 0;
}
int main() {
  cin >> n >> m;
  int now;
  int last = n - m;
  for (int i = (n + 2) / 2; i <= n - m; i++) {
    now = last;
    for (int j = m + 1; j <= n - m && now >= m + 1; j++) {
      while (now >= m + 1 && !chk(i, j, now, n + 1 - i)) now--;
      ans += now - m;
      if (j == m + 1) last = now;
    }
  }
  ans *= 2;
  if (n % 2 == 1) {
    int i = (n + 2) / 2;
    now = n - m;
    for (int j = m + 1; j <= n - m && now >= m + 1; j++) {
      while (now >= m + 1 && !chk(i, j, now, n + 1 - i)) now--;
      ans -= now - m;
      if (j == m + 1) last = now;
    }
  }
  cout << 3 * ans << endl;
  return 0;
}
