#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
long long Calc(long long n, int K) {
	int i;
	K++;
	long long r = 0;
	for (i = 1; i <= K; i++) {
		long long t;
		if(i!=K)t = (long long)( powl(n, 1.0L / (K - i + 1)) + 1 - 1e-8);
		else t = n;
		n = (n+t-1)/t;
		r += t;
	}
	return r;
}
int main() {
	int i;
	long long N, A, res = 1e18;
	scanf("%lld%lld", &N, &A);
	for (i = 0; i <= 50; i++) {
		res = min(res, Calc(N, i) + A*i);
	}
	printf("%lld\n", res);
}