#include <bits/stdc++.h>
using namespace std;
const int MAXN = 40000;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  if (m * 2 >= n) {
    puts("0");
    return 0;
  }
  long long ans = 0;
  for (int i = m + 1, top = (n + 1) / 2; i <= top; i++) {
    int cnt = 0, mx = (((n << 1) - m - (i << 1) + 1) * i - 1) / (n + m + 2 - i);
    for (int j = m + 1; j <= mx; j++) {
      int top = (2 * i - j) * (n + 1 - i) - 1, bot = i + j, k = top / bot;
      if (k > m) cnt += min(k, n - m) - m;
    }
    ans += (i <= n - i) ? 2ll * cnt : cnt;
  }
  ans *= 3;
  printf("%I64d\n", ans);
  return 0;
}
