#include <bits/stdc++.h>
using namespace std;
int n, m;
long long ans;
inline long long _(long long b, long long c, long long k) {
  return min(b - 1, (c - 1) / k);
}
int main() {
  ans = 0;
  cin >> n >> m;
  for (long long b = 1; b <= n; b++) {
    ans += min(b * b, (long long)m) << 1;
    for (long long A = b - 1; A > 0; A--) {
      if (b * b - A * A > m) break;
      long long c = b * b - A * A;
      if (_(b, c, (b + A) << 1) > 0) ans--;
      if (_(b, c, (b - A) << 1) > 0) ans--;
    }
    if (b * b <= m) {
      long long c = b * b;
      ans--;
      if (_(b, c, b << 1) > 0) ans--;
    }
  }
  cout << ans << endl;
  return 0;
}
