#include <bits/stdc++.h>
int v[10000010];
int main() {
  memset(v, 0, sizeof(v));
  int n, m;
  scanf("%d%d", &n, &m);
  long long ans = 0;
  int i;
  for (i = 1; i <= n; i++) {
    long long tmp;
    tmp = i;
    tmp = tmp * i;
    if (tmp > m) {
      ans += m * 2;
    }
    if (tmp == m) {
      ans += (m - 1) * 2;
      ans++;
    }
    if (tmp < m) {
      ans += (tmp - 1) * 2;
      ans += 1;
    }
    int j = i - 1;
    long long t, d;
    t = j;
    t = t * j;
    d = tmp - t;
    while ((d >= 1) && (d <= m) && (j >= 0)) {
      v[-j - i + 10000000]++;
      if (j != 0) v[j - i + 10000000]++;
      j--;
      t = j;
      t = t * j;
      d = tmp - t;
    }
  }
  for (i = 0; i <= 10000000; i++)
    if (v[i]) {
      ans -= v[i];
      ans++;
    }
  printf("%I64d\n", ans);
}
