#include <bits/stdc++.h>
using namespace std;
int n, m;
long long ans;
int calc(int x, int y) { return x * x + y * y - x * y; }
int main() {
  scanf("%d%d", &n, &m);
  for (int x = m + 1; x <= (n + 1) / 2; x++) {
    for (int y = m + 1, k = n - m; y <= n - m && k > m; y++) {
      while (k > m &&
             calc(n + 1 - x, k) + calc(x, y) >= calc(n + 1 - k, n + 1 - y))
        --k;
      ans += k - m;
      if (!((n & 1) && x == (n + 1) / 2)) ans += k - m;
    }
  }
  cout << ans * 3 << endl;
  return 0;
}
