// 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){      

      assert(x/i>=2);

      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){

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

    };

    

    auto best=[&](Int 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 l=0,r=1e18;

      Int v=calc2(x);

      while(l+1<r){

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

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

	else r=m;

      }

      return best(x+r);

    };

    

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

    l=best(l);

    r=best(r);

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

      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));

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

      else r=m;

    }

    chmin(ans,calc(l));

    chmin(ans,calc(r));

  }



  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: