#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
vector<string> d1;
long long binPow(long long a, long long n) {
  int res = 1;
  if (a == 0) return 0;
  while (n) {
    if (n & 1) res = (res * a);
    a = (a * a);
    n >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void solve() {
  long long n, m;
  scanf("%lld", &n);
  ;
  scanf("%lld", &m);
  ;
  set<pair<long double, long double>> s;
  set<long double> o;
  long long cnt = 0;
  long long lm = 1;
  for (long long i = 1; i <= n; i++) {
    long long k = min(i * i, m);
    cnt += k * 2;
  }
  for (long long i = 1; i <= n; i++) {
    long long k = min(2 * n - i, m / i);
    if (k < i) break;
    if ((k - i) % 2 == 1)
      cnt -= (k - i + 1);
    else
      cnt -= (k - i + 2);
  }
  cnt += min(n, m / 4 + 1);
  cnt += min(n, (m + 1) / 2);
  cout << --cnt << endl;
}
signed main() { solve(); }
