#include <bits/stdc++.h>
using namespace std;
const int iinf = 1 << 29;
const long long inf = 1ll << 60;
const long long mod = 1e9 + 7;
void GG() {
  cout << "-1\n";
  exit(0);
}
long long mpow(long long a, long long n, long long mo = mod) {
  long long re = 1;
  while (n > 0) {
    if (n & 1) re = re * a % mo;
    a = a * a % mo;
    n >>= 1;
  }
  return re;
}
long long inv(long long b, long long mo = mod) {
  if (b == 1) return b;
  return (mo - mo / b) * inv(mo % b) % mo;
}
const int maxn = 3e5 + 5;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  long long re = 0;
  int n1 = n + 1;
  int midway = 1 + (n) / 2;
  for (int x = m + 1; x < (midway); x++) {
    int b = n - m;
    for (int a = m + 1; a < n1 - m; ++a) {
      while (b > m &&
             (((n1 - x) << 1) - b) * (long long)(a - (x << 1)) + 3 * a * b >=
                 0) {
        --b;
      }
      if (b <= m) break;
      re += b - m;
    }
  };
  re <<= 1;
  if (n & 1) {
    int x = (midway);
    int b = n - m;
    for (int a = m + 1; a < n1 - m; ++a) {
      while (b > m &&
             (((n1 - x) << 1) - b) * (long long)(a - (x << 1)) + 3 * a * b >=
                 0) {
        --b;
      }
      if (b <= m) break;
      re += b - m;
    }
  }
  cout << re * 3 << '\n';
}
