#include <bits/stdc++.h>
using namespace std;
const int inf = ~0U >> 1;
const long long INF = ~0ULL >> 1;
template <class T>
inline void read(T &n) {
  char c;
  for (c = getchar(); !(c >= '0' && c <= '9'); c = getchar())
    ;
  n = c - '0';
  for (c = getchar(); c >= '0' && c <= '9'; c = getchar()) n = n * 10 + c - '0';
}
int Pow(int base, int n, int mo) {
  if (n == 0) return 1;
  if (n == 1) return base % mo;
  int tmp = Pow(base, n >> 1, mo);
  tmp = (long long)tmp * tmp % mo;
  if (n & 1) tmp = (long long)tmp * base % mo;
  return tmp;
}
template <class T>
inline T sqr(const T &x) {
  return x * x;
}
int n, m;
long long ans;
int main() {
  scanf("%d%d", &n, &m);
  int c1 = 2 * (n + 1) * (n + 1);
  int c2 = 2 * (n + 1);
  int c4 = n + 1;
  for (int z = m + 1; z <= n - m; z++) {
    int c3 = 2 * z * z;
    for (int y = (n - m); y >= (m + 1); --y) {
      int low = (c3 - c2 * z + c1 - c4 * y - y * z) / (c2 - z - y);
      if (m > low) low = m;
      if (low > n - m) break;
      ans += n - m - low;
    }
  }
  printf("%lld\n", ans * 3);
  return 0;
}
