import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto s = readln.split.map!(to!long);
    auto N = s[0];
    auto A = s[1];
    
    long ans = N;

    for (long x = 2; x * x <= N; x++)
        for (long n = 1, a = 0; n <= N; n *= x, a += A + x) 
            ans = min(ans, N / n + (N % n > 0) + a);

    ans.writeln;
}
