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, core.stdc.string;

immutable long MOD = 10^^9 + 7;

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

    if (N == 1) {
        writeln(1);
        return;
    }

    long[] X;

    for (long i = 1; i <= N; ) {
        X ~= i;
        long j = N / i + (N % i != 0);
        long hi = N + 1;
        long lo = i;
        while (hi - lo > 1) {
            long mid = (hi + lo) / 2;
            long k = N / mid + (N % mid != 0);
            if (k == j) {
                lo = mid;
            } else {
                hi = mid;
            }
        }
        i = lo + 1;
    }

    int M = X.length.to!int;
    auto dp = new long[](M);
    foreach (i; 0..M) dp[i] = X[i];

    foreach (i; 1..M-1) {
        foreach (j; i+1..M) {
            dp[j] = min(dp[j], dp[i] + A + X[j] / X[i] + (X[j] % X[i] > 0));
        }
    }

    dp[M-1].writeln;
}
