#include <bits/stdc++.h>

using namespace std;

#define INF 1145141919810364
typedef long long LL;

LL N, A;

void input()
{
  cin >> N >> A;
}

LL keta(LL l){
  LL ret = 0;
  while(l){
    ret++;
    l /= 10;
  }
  return ret;
}

LL mPow(LL t, LL k)
{
  LL ret = 1;
  for (size_t i = 0; i < k; i++) {
    if(keta(ret) + keta(t) > 15){
      return INF;
    }
    ret *= t;
    if(ret > INF){
      return INF;
    }
  }
  return ret;
}

LL mKake(LL l, LL r)
{
  if(keta(l) + keta(r) > 15){
    return INF;
  }
  else{
    return l*r;
  }
}

LL solve()
{
  LL ret = 1145141919810364;

  for (LL eat = 0; eat < 40; eat++) {
    LL l = 0, r = N+1;
    //cerr << "Eat: " << eat << endl;
    while(r - l > 1){
      LL mid = (r+l)/2;
      //cerr << mid << " " << mPow(mid, eat+1) << endl;
      if(mPow(mid, eat+1) >= N){
        r = mid;
      }
      else{
        l = mid;
      }
    }
    //cerr << eat << " " << r << " " << mPow(r, eat+1) << endl;
    LL M = r; LL m = 0;
    for (m = eat+1; 0 <= m; m--) {
      if(mKake(mPow(M-1, m), mPow(M, eat+1-m)) >= N){
        break;
      }
    }

    ret = min(ret, A*eat + m*(M-1) + (eat+1-m)*M);

  }

  return ret;

}

int main()
{
  input();

  cout << solve() << endl;

  return 0;
}
