#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e6;
int n, m;
ll ans, c;
int calc(int d, int n) {
  n -= d;
  if (n < 0) return 0;
  return n;
}
int main() {
  cin >> n >> m;
  ans = 1;
  c = 1;
  for (ll i = 2; i <= n; ++i) {
    ll t = i * i;
    while (t >= c + 1 && c + 1 <= m) c++;
    ans += 2 * c;
    if (t == c) ans--;
  }
  for (int k = 1; k <= N; ++k) {
    ll p, q, b1, b2, b3, b4;
    p = 2 * k;
    q = (ll)k * k;
    b1 = (1 + q) / p;
    if ((1 + q) % p != 0) b1++;
    b2 = (m + q) / p;
    b3 = max(b1, (ll)1);
    b4 = min(b2, (ll)n);
    if (b3 > b4) continue;
    ans -= b4 - b3;
  }
  cout << ans << endl;
}
