#include <bits/stdc++.h>
int n, m;
inline long long min(long long a, long long b) { return a < b ? a : b; }
inline long long max(long long a, long long b) { return a > b ? a : b; }
int main() {
  scanf("%d%d", &n, &m);
  long long ans = 0;
  for (register int i = m + 1; i + i - 1 <= n; i++) {
    long long p = m + 1;
    int k = n - i + 1;
    long long A = (n + 1 - p) * (i + m + 1),
              B = (long long)(i + i - (m + 1)) * k;
    for (int j = m + 1; j <= n - m; j++, A += n + 1 - p, B -= k) {
      if (j >= (i << 1)) break;
      while (p <= n - m && A >= B) {
        ++p;
        A -= i + j;
      }
      if (i + i - 1 == n)
        ans = ans + n - m - p + 1;
      else
        ans = ans + ((n - m - p + 1) << 1);
    }
  }
  ans *= 3;
  printf(
      "%I64d"
      "\n",
      ans);
  return 0;
}
