#include <iostream>
#include <cmath>

using namespace std;
typedef unsigned long long ll;
ll n,a;
ll solve(int m){
	long double x = pow(n,(double)(1/(double)m));
	ll b = x,res = 1,i;
	for(i=0;i<m;i++) res *= b;
	ll ret = b*m + a*(m-1);
	while(res<n){
		ret++;
		res /= b;
		res *= (b + 1);
	}
	return ret;
}

int main(){
	ll i,ans = 100000000000000;;
	cin >> n >> a;
	for(i=1;i<50;i++){
		ans = min(ans,solve(i));
		if(solve(i)>ans) break;
	}
	cout << ans << endl;
}