#include <bits/stdc++.h>
using namespace std;
long long m, n;
int main() {
  cin >> n >> m;
  long long res = m * n * 2;
  for (int r = 1; r < 10000000; r++) {
    long long lo = (r + 2) / 2;
    long long hi = min(n, ((long long)r * r + m) / (2 * r));
    if (lo <= hi) {
      res -= hi - lo;
    }
  }
  int fin = min(int(n), int(sqrt(m + 0.5)));
  for (int b = 1; b < fin + 1; b++) {
    long long lo = b * b + 1;
    long long hi = m;
    if (lo <= hi) res -= 2 * (hi - lo + 1);
  }
  cout << res - fin << endl;
}
