#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  cin >> n >> m;
  long long res = 0;
  for (int i = 1; i < 2 * n; i++) {
    if (i % 2 == 1 && i <= m)
      res++;
    else if (i % 2 == 0 && i * 2 <= m)
      res++;
  }
  for (int i = 1; i <= n; i++) {
    long long low = max(1ll, (long long)i * (long long)i - (long long)m);
    int lowA = sqrt(low);
    int nDiscarded = i - 1 - lowA;
    if ((long long)lowA * (long long)lowA == low) nDiscarded++;
    res += 2 * (((long long)i * (long long)i - low) - (long long)nDiscarded);
  }
  cout << res << endl;
  return 0;
}
