#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

const int M = 3e6;

ll n, A;
ll ans;

ll up(ll x, ll y) {
  return (x + y - 1) / y;
}

void read() {
  cin >> n >> A;
  ans = n;
}

void uin(ll &x, ll y) {
  x = min(x, y);
}

void kill() {
  for (int m = 1; m <= 45; ++m) {
    ll p = 1;
    ll sum = m;
    ll a = 1;

    while (true) {
      uin(ans, m * A + sum + up(n, p));
      if (p >= n)
        break;

      if (a >= M)
        break;


      sum++;
      p /= a;
      p *= a + 1;
      if (sum % m == 0)
        ++a;
    } 

  }

  cout << ans << endl;
}

int main() {
#ifdef LOCAL
  assert(freopen("e.in", "r", stdin));
#endif

  ios_base::sync_with_stdio(false);

  read();
  kill();

}

