#include <bits/stdc++.h>
using namespace std;
long long ev(int a) { return (long long)a / 2; }
long long od(int a) { return (long long)a - (a / 2); }
int main() {
  int n, m, p, q;
  long long ans = 0;
  cin >> n >> m;
  ans += ev(min(2 * n - 2, m / 2)) + od(min(2 * n - 1, m));
  for (int b = 1; b <= n; b++)
    ans += (long long)2 *
           (min((long long)m, (long long)b * (long long)b - (long long)1) -
            (long long)((int)sqrt(max(0.0, (double)b * (double)b - 1.0)) -
                        (int)sqrt(max(
                            0.0, (double)b * (double)b - (double)m - 1.0))));
  cout << ans << endl;
  return 0;
}
