#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long p[100005], p3[100005];
long long q3(long long x) { return x > 0 ? p3[x] : p3[-x]; }
long long q(long long x) { return x > 0 ? p[x] : p[-x]; }
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  for (long long i = 1; i <= 1e5; i++) {
    p[i] = i * i;
    p3[i] = 3 * i * i;
  }
  long long n, m, ans = 0;
  cin >> n >> m;
  for (long long i = m + 1; i <= n - m; i++) {
    long long l = m + 1, r = n - m;
    for (long long j = n - m; j >= i; j--) {
      long long t = q3(j - i) + q(i + j);
      while (r >= l && q3(n + 1 - j) + q(n + 1 - l - l - i) + q3(n + 1 - i) +
                               q(n + 1 - l - l + j) >=
                           t)
        l++;
      while (r >= l &&
             q3(n + 1 - j) + q(n + 1 - (n + 1 - r) - (n + 1 - r) - j) +
                     q3(n + 1 - i) + q(n + 1 - (n + 1 - r) - (n + 1 - r) + i) >=
                 t)
        r--;
      if (l > r) break;
      ans = ans + (r - l + 1) + (i == j ? 0 : (r - l + 1));
    }
  }
  cout << ans * 3;
  return 0;
}
