#include <iostream>
#include <vector>

using lint = long long;

void solve() {
    lint n, a;
    std::cin >> n >> a;

    lint ok = n, ng = -1;
    while (ok - ng > 1) {
        lint mid = (ok + ng) / 2;

        bool judge = false;
        for (lint t = 0;; ++t) {
            lint x = mid - a * t;
            lint low = x / (t + 1);
            if (x < 0 || low == 0) break;

            int hcnt = x - low * (t + 1);
            lint acc = 1;
            for (int i = 0; i < t + 1; ++i) {
                lint y = (i < hcnt ? low + 1 : low);
                if (y > n / acc) {
                    judge = true;
                    break;
                } else {
                    acc *= y;
                }
            }

            if (acc >= n) judge = true;
            if (judge) break;
        }

        if (judge) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    std::cout << ok << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
