// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



using Int = __int128_t;

Int abs128(Int val){return val<0?-val:val;}



ostream &operator<<(ostream &os,Int val){

  if(ostream::sentry(os)){

    __uint128_t tmp=abs128(val);

    char buf[64];

    char *d=end(buf);

    do{

      --d;

      *d=char(tmp%10+'0');

      tmp/=10;

    }while(tmp);

    if(val<0) *--d='-';

    Int len=end(buf)-d;

    if(os.rdbuf()->sputn(d,len)!=len){

      os.setstate(ios_base::badbit);

    }

  }

  return os;

}



istream &operator>>(istream &is,Int &val){

  string s;

  is>>s;

  val=0;

  for(Int i=0;i<(Int)s.size();i++)

    if(isdigit(s[i])) val=val*10+s[i]-'0';

  if(s[0]=='-') val*=-1;

  return is;

}







template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}

template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}



//INSERT ABOVE HERE

signed main(){

  Int n,a;

  cin>>n>>a;

 

  

  Int ans=n;

  for(Int i=1;i<100;i++){

    auto calc2=[&](Int x){

      vector<Int> v(i,x/i);

      for(Int j=0;j<x%i;j++) v[j]++;

      Int s=1;

      for(Int j=0;j<i;j++){

	if(s<(n+v[j]-1)/v[j]) s*=v[j];

	else s=n;

	if(s>=n) break;

      }

      return (n+s-1)/s;

    };

    

    auto calc=[&](Int x){

      if(x<0) return ans;

      return i*a+x+calc2(x);

    };

    

    auto best=[&](Int x){

      if(x<0) return x;

      Int l=0,r=x-2*i+1;

      Int v=calc2(x);

      while(l+1<r){

	Int m=(l+r)>>1;

	if(v==calc2(x-m)) l=m;

	else r=m;

      }

      return x-l;

    };

    

    auto next=[&](Int x)->Int{

      if(x<0) return x;

      Int l=0,r=1e18;

      Int v=calc2(x);

      if(v==calc2(x+r)) return -1;

      while(l+1<r){

	Int m=(l+r)>>1;

	if(v==calc2(x+m)) l=m;

	else r=m;

      }

      //assert(best(x+r)==x+r);

      return x+r;

    };

    

    Int l=i*2,r=1e18;    

    while((l+1<r)&&(calc2(r)+1<calc2(l))){

      //cout<<l<<" "<<calc(l)<<endl;

      //cout<<r<<" "<<calc(r)<<endl;

      l=best(l);

      r=best(r);

      chmin(ans,calc(l));

      chmin(ans,calc(r));

      Int m=best((l+r)>>1);

      Int t=next(m);

      chmin(ans,calc(m));

      chmin(ans,calc(t));

      if(calc2(t)+(t-m)==calc2(m))

	for(Int j=m+1;calc2(j)<calc2(j-1);j++) chmin(ans,calc(j));

      

      //cout<<i<<":"<<m<<" "<<t<<":";

      //cout<<calc2(t)<<" "<<calc2(m)<<":"<<calc(m)<<" "<<calc(t)<<endl;    

      if(calc2(t)+(t-m)<calc2(m)) l=m;

      else r=m;

    }

    l=best(l);

    r=best(r);

    chmin(ans,calc(l));

    chmin(ans,calc(r));



    const Int MAX = 0;

    

    Int pl=l,pr=r;

    for(Int j=0;j<MAX;j++){

      if(l==i*2) break;

      l=best(l-1);

      chmin(ans,calc(l));

    }

    for(Int j=0;j<MAX;j++){

      if(r==i*2) break;

      r=best(r-1);

      chmin(ans,calc(r));

    }

    

    l=pl;r=pr;

    for(Int j=0;j<MAX;j++){

      l=next(l);

      if(l<0) break; 

      chmin(ans,calc(l));      

    }

    for(Int j=0;j<MAX;j++){

      r=next(r);

      if(r<0) break; 

      chmin(ans,calc(r));      

    }

    

    l=i*2;

    for(Int j=0;j<MAX;j++){

      l=next(l);

      if(l<0) break; 

      chmin(ans,calc(l));      

    }

  }



  cout<<ans<<endl;

  return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;



using Int = __int128_t;

Int abs128(Int val){return val<0?-val:val;}



ostream &operator<<(ostream &os,Int val){

  if(ostream::sentry(os)){

    __uint128_t tmp=abs128(val);

    char buf[64];

    char *d=end(buf);

    do{

      --d;

      *d=char(tmp%10+'0');

      tmp/=10;

    }while(tmp);

    if(val<0) *--d='-';

    Int len=end(buf)-d;

    if(os.rdbuf()->sputn(d,len)!=len){

      os.setstate(ios_base::badbit);

    }

  }

  return os;

}



istream &operator>>(istream &is,Int &val){

  string s;

  is>>s;

  val=0;

  for(Int i=0;i<(Int)s.size();i++)

    if(isdigit(s[i])) val=val*10+s[i]-'0';

  if(s[0]=='-') val*=-1;

  return is;

}







template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}

template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}



//INSERT ABOVE HERE

signed main(){

  Int n,a;

  cin>>n>>a;

  

  Int ans=n;

  for(Int i=1;i<100;i++){

    auto calc=[&](Int x)->Int{

      vector<Int> v(i,x/i);

      for(Int j=0;j<x%i;j++) v[j]++;

      Int s=1;

      for(Int j=0;j<i;j++){

	if(s<(n+v[j]-1)/v[j]) s*=v[j];

	else return 1;

      }

      return s>=n;

    };

    

    Int l=i*2-1,r=l+ans;

    while(l+1<r){

      Int m=(l+r)>>1;

      if(calc(m)) r=m;

      else l=m;

    }

    chmin(ans,(i-1)*a+r);

  }



  cout<<ans<<endl;

  return 0;

}


// Fastest known solution for this problem: