#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

const ll inf = 1000000000000000000LL;

ll pw(ll x, ll y) {
	ll s = 1;
	for (int i = 0; i < y; i ++) {
		if (inf/x < s) return inf;
		s *= x;
	}
	return s;
}

ll ff(ll x, ll y) {
	ll le = 1, ri = x;
	while (le <= ri) {
		ll mi = (le+ri)/2;
		if (pw(mi, y) > x) ri = mi-1;
		else le = mi+1;
	}
	return ri;
}

int main() {
	ll N, A;
	cin >> N >> A;
	ll S = N;
	for (ll n = 1; n <= 40; n++) {
		// find N^(1/(n+1))
		ll le = ff(N, n+1);
		ll ri = le+1;
		for (int m = 0; m <= n; m++) {
			ll T = 0;
			ll U = 1;
			for (int i = 0; i < m; i ++) {
				T += le;
				U *= le;
			}
			for (int i = m; i < n; i ++) {
				T += ri;
				U *= ri;
			}
			if (N%U == 0) T += N/U; else T += N/U+1;
			T += A*n;
			S = min(S, T);
		}
	}
	cout << S << endl;
	return 0;
}