#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  long long ans = 0;
  for (int b = m + 1; 2 * b <= n; b++) {
    int c = 2 * b * b - 2 * b * n - 2 * b + m * b + b;
    int d = b - n - 2 - m;
    for (int a = m + 1; a <= min(n - m, c / d); a++) {
      int x = (a + b);
      int y = -2 * b * b + a * b + 2 * b * n - a * n - a + 2 * b;
      int c = y / x;
      if (c > n - m)
        ans += n - 2 * m;
      else if (c == n - m) {
        if (y % x == 0)
          ans += n - 2 * m - 1;
        else
          ans += n - 2 * m;
      } else if (c >= m + 1) {
        if (y % x == 0)
          ans += c - m - 1;
        else
          ans += c - m;
      }
    }
  }
  ans *= 2;
  if (n & 1) {
    int b = (n + 1) / 2;
    int c = 2 * b * b - 2 * b * n - 2 * b + m * b + b;
    int d = b - n - 2 - m;
    for (int a = m + 1; a <= min(n - m, c / d); a++) {
      int x = (a + b);
      int y = -2 * b * b + a * b + 2 * b * n - a * n - a + 2 * b;
      int c = y / x;
      if (c > n - m)
        ans += n - 2 * m;
      else if (c == n - m) {
        if (y % x == 0)
          ans += n - 2 * m - 1;
        else
          ans += n - 2 * m;
      } else if (c >= m + 1) {
        if (y % x == 0)
          ans += c - m - 1;
        else
          ans += c - m;
      }
    }
  }
  cout << ans * 3 << endl;
  return 0;
}
