#include <bits/stdc++.h>
using namespace std;
template <class R>
inline void Readin(R &K) {
  bool F = K = 0;
  char C = getchar();
  while (C < '0' || C > '9') {
    if (C == '-') F = 1;
    C = getchar();
  }
  while (C <= '9' && C >= '0') K = (K << 1) + (K << 3) + C - '0', C = getchar();
  if (F) K = -K;
}
template <class R>
inline bool Checkmax(R &A, R B) {
  return A < B ? A = B, 1 : 0;
}
template <class R>
inline bool Checkmin(R &A, R B) {
  return A > B ? A = B, 1 : 0;
}
long long N, M, Ans;
bitset<10000000> Vis;
signed main() {
  Readin(N);
  Readin(M);
  for (register long long i = 0; ++i <= N;) {
    Ans += min(i * i, M) << 1;
    for (register long long j = i; --j >= 0;) {
      if ((i + j) * (i - j) > M) break;
      if (Vis[i + j])
        --Ans;
      else
        Vis[i + j] = true;
      if (Vis[i - j])
        --Ans;
      else
        Vis[i - j] = true;
    }
  }
  return not printf("%lld\n", Ans);
}
