#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  static bool mem[10000001];
  while (cin >> n >> m) {
    memset(mem, false, sizeof(mem));
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
      ans += 2 * min(m, (long long)i * i);
      int sum = 0;
      for (int j = i - 1; j >= 0; j--) {
        sum += 2 * j + 1;
        if (sum > m) break;
        ans -= 2;
        if (!mem[-i + j + 5000000]) {
          mem[-i + j + 5000000] = true;
          ans++;
        }
        if (!mem[-i - j + 5000000]) {
          mem[-i - j + 5000000] = true;
          ans++;
        }
      }
    }
    cout << ans << endl;
  }
}
