#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  unsigned long long int countInt = 0, countIr = 0;
  if (2 * n - 1 >= m) {
    if (m % 2 == 1) {
      countInt += (m - 1) / 2 + 1;
      if ((m - 1) % 4 == 0) {
        countInt += (m - 1) / 4;
      } else {
        countInt += ((m - 1) / 2 - 1) / 2;
      }
    } else {
      countInt += m / 2;
      if (m % 4 == 0) {
        countInt += m / 4;
      } else {
        countInt += (m / 2 - 1) / 2;
      }
    }
  } else {
    countInt += n;
    if (m % 2 == 1) {
      if (((m - 1) / 2) % 2 == 1) {
        countInt += n - max(1, (n - ((m - 1) / 2 - 1) / 2));
      } else {
        countInt += n - max(1, n - (m - 1) / 4);
      }
    } else {
      if (m / 2 % 2 == 1) {
        countInt += n - max(1, n - (m / 2 - 1) / 2);
      } else {
        countInt += n - max(1, n - m / 4);
      }
    }
  }
  for (unsigned long long int b = 1; b <= n; b++) {
    if (b * b <= m) {
      countIr += b * b - b;
    } else {
      int countk = b - ceil(sqrt(b * b - m));
      countIr += m - countk;
    }
  }
  countIr *= 2;
  cout << countIr + countInt << endl;
  return 0;
}
