#include <bits/stdc++.h>
using namespace std;
int n, m;
long long res;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    long long len = min((long long)i * i, (long long)m);
    if (len == (long long)i * i)
      res += 2 * len - 1;
    else
      res += 2 * len;
  }
  for (int i = 1; i <= 10000000; i++) {
    long long tmp = (long long)i * i;
    long long mod = 2 * i;
    long long beg = tmp + (mod - tmp % mod);
    long long fin = (tmp + m) / mod * mod;
    if (fin <= beg) continue;
    long long fir = beg / mod;
    long long end = fin / mod;
    if (fir >= n) continue;
    res -= (min((long long)n, end) - fir);
  }
  cout << res << endl;
  return 0;
}
