#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long ans = 0;
  for (long long b = 1; b <= n; b++) {
    ans += 2 * min(b * b - 1, m);
    if (b * b <= m) ans += 1;
  }
  for (long long x0 = -10000000; x0 < 0; x0++) {
    long long c1 = m / (-x0);
    if (c1 < 1) continue;
    long long v2 = (c1 - x0) / 2;
    long long v1 = (2 - x0) / 2;
    if (v1 < 1) v1 = 1;
    if (v2 > n) v2 = n;
    if (v2 < v1) continue;
    ans -= v2 - v1;
  }
  cout << ans << endl;
  return 0;
}
