#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, m = 0;
  long long res;
  scanf("%d%d", &n, &m);
  for (int b = 1; b <= n; ++b) {
    long long tmp = (long long)b * b;
    if (tmp <= m) {
      res += (tmp << 1) - 1;
    } else {
      res += m << 1;
    }
  }
  for (int u = -n * 2; u < 0; ++u) {
    int v = max(-2 * n - u, m / u);
    if (u & 1) {
      --v;
    }
    int tmp = -1 - v + 1 >> 1;
    if (tmp > 1) {
      res -= tmp - 1;
    }
  }
  printf("%I64d", res);
  return 0;
}
