#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
class vpiisort {
 public:
  bool operator()(pair<int, int> &a, pair<int, int> &b) {
    return a.first < b.first;
  }
};
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long genans = 0;
  int a = 0;
  for (long long i = 0; i < n; i += 1) {
    long long aa = (i + 1) * (i + 1);
    if (aa <= m)
      genans += 2 * aa - 1;
    else
      genans += 2 * m;
  }
  long long reps = 0;
  for (long long i = 0; i < 10000000; i += 1) {
    long long currnum = i + 1;
    long long pos = m / currnum;
    long long currreps =
        min((2 * n - currnum + 1) / 2,
            (pos + ((currnum % 2 == 1) ? pos % 2 : -1 * pos % 2)) / 2) -
        1;
    if (min((2 * n - currnum + 1) / 2,
            (pos + ((currnum % 2 == 1) ? pos % 2 : -1 * pos % 2)) / 2) -
            1 >=
        0)
      reps += currreps;
  }
  cout << genans - reps << endl;
  return 0;
}
