n,a=list(map(int,input().split()))

ans=10**12+5

for eat_num in range(45):

    if 2**(eat_num-1)>n:break

    time=eat_num*a

    t=eat_num+1

    l=0;r=n

    while r-l>1:

        m=(r+l)/2

        if m**t>=n:r=m

        else:l=m

    for j in range(t+1):

        if r**(t-j) * (r-1)**j < n:break

        surplus=j

    ans=min(ans,time+r*(t-surplus)+(r-1)*surplus)

print(ans)
n,a=list(map(int,input().split()))

ans=10**12+5

for eat_num in range(45):

    if 2**(eat_num-1)>n:break

    time=eat_num*a

    bake=eat_num+1

    l=0;r=n

    while r-l>1:

        m=(r+l)/2

        if m**bake>=n:r=m

        else:l=m

    for surplus in range(1,bake+1):

        if r**(bake-surplus) * (r-1)**surplus < n:break

    surplus-=1

    time+=r*(bake-surplus)+(r-1)*surplus

    ans=min(ans,time)

print(ans)
n, a = list(map(int, input().split()))
ans = 10**12 + 5
for eat_num in range(45):
    if 2 ** (eat_num - 1) > n:
        break
    time = eat_num * a
    t = eat_num + 1
    l = 0
    r = n
    while r - l > 1:
        m = (r + l) / 2
        if m**t >= n:
            r = m
        else:
            l = m
    for j in range(t + 1):
        if r ** (t - j) * (r - 1) ** j < n:
            break
        surplus = j
    ans = min(ans, time + r * (t - surplus) + (r - 1) * surplus)
print(ans)

n, a = list(map(int, input().split()))
ans = 10**12 + 5
for eat_num in range(45):
    if 2 ** (eat_num - 1) > n:
        break
    time = eat_num * a
    bake = eat_num + 1
    l = 0
    r = n
    while r - l > 1:
        m = (r + l) / 2
        if m**bake >= n:
            r = m
        else:
            l = m
    for surplus in range(1, bake + 1):
        if r ** (bake - surplus) * (r - 1) ** surplus < n:
            break
    surplus -= 1
    time += r * (bake - surplus) + (r - 1) * surplus
    ans = min(ans, time)
print(ans)

-    t = eat_num + 1 +    bake = eat_num + 1 -        if m**t >= n: +        if m**bake >= n: -    for j in range(t + 1): -        if r ** (t - j) * (r - 1) ** j < n: +    for surplus in range(1, bake + 1): +        if r ** (bake - surplus) * (r - 1) ** surplus < n: -        surplus = j -    ans = min(ans, time + r * (t - surplus) + (r - 1) * surplus) +    surplus -= 1 +    time += r * (bake - surplus) + (r - 1) * surplus +    ans = min(ans, time)