#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, X;
  cin >> N >> X;
  long long int ans = N;
  long double tri = X * (N - X) * sqrt(3) * 0.5;
  while (1) {
    if (tri < sqrt(3) * 0.5) break;
    for (double i = X; i >= 0.0; i -= 1.0) {
      if (i * i * sqrt(3) * 0.5 <= tri) {
        tri -= i * i * sqrt(3) * 0.5;
        ans += 2 * i;
        X = i;
        tri += 0.000001;
        break;
      }
    }
  }
  cout << ans - X << endl;
  return 0;
}
