#include <bits/stdc++.h>
using namespace std;
inline int F(int a, int b) { return a * a + b * b - a * b; }
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int N = n + 1;
  long long res = 0;
  for (int i = m + 1; i <= (n + 1) / 2; ++i) {
    int p = 0;
    int j = m + 1, k = m + 1;
    int S = 2 * i * i + N * (N + j - 3 * i - k) + i * (j + k) - j * k;
    int x = i - N, y = i + N;
    for (; j <= n - m; ++j) {
      while (k <= n - m && S >= 0) {
        S += x - j;
        ++k;
      }
      p += n - m + 1 - k;
      S += y - k;
    }
    if ((n & 1) && i == (n + 1) / 2)
      res += p;
    else
      res += 2 * p;
  }
  printf("%lld\n", 3 * res);
  return 0;
}
