#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
signed main(){
	int n,a;
	cin>>n>>a;
	double loga = log(1.0*n);
	int ans = LINF;
	for(int k=0;k<=40;k++){
		int ng = 0, ok = (1LL<<40);
		while( ok - ng > 1 ){
			int mid = ( ok + ng ) / 2;
			double cur = log( 1.0 * mid ) * (k + 1);
			if( cur >= loga ){
				ok = mid;
			}
			else{
				ng = mid;
			}
		}
		int c = 1, cnt = 0;
		for(int i=1;i<=k+1;i++){
			c *= ok;
		}
		while( (c/ok)*(ok-1) >= n ){
			cnt++;
			c = (c/ok) * (ok-1);
		}
		int tmp = a*k + ok*(k+1) - cnt;
		if( ans > tmp ) ans = tmp;
	}
	cout<<ans<<endl;
	return 0;
}