#pragma comment(linker, "/STACK:512000000")
#define _CRT_SECURE_NO_WARNINGS
//#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve();
void precalc();
clock_t start;
//int timer = 1;

int testNumber = 1;

bool todo = true;

int main() {
#ifdef AIM
    freopen("/home/alexandero/ClionProjects/ACM/input.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    start = clock();
    int t = 1;
    cout.sync_with_stdio(0);
    cin.tie(0);
    precalc();
    cout.precision(10);
    cout << fixed;
    //cin >> t;
    int testNum = 1;
    while (t--) {
        //cerr << testNum << endl;
        //cout << "Case #" << testNum++ << ": ";
        solve();
        ++testNumber;
        //++timer;
    }

#ifdef AIM
    cerr << "\n\n time: " << (clock() - start) / 1.0 / CLOCKS_PER_SEC << "\n\n";
#endif

    return 0;
}

//BE CAREFUL: IS INT REALLY INT?

template<typename T>
T binpow(T q, T w, T mod) {
    if (!w)
        return 1 % mod;
    if (w & 1)
        return q * 1LL * binpow(q, w - 1, mod) % mod;
    return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
    while (w) {
        q %= w;
        swap(q, w);
    }
    return q;
}
template<typename T>
T lcm(T q, T w) {
    return q / gcd(q, w) * w;
}

void precalc() {

}

#define int li

//const int mod = 1000000007;

bool more(int mn, int mins, int mx, int maxes, int n) {
    for (int i = 0; i < mins; ++i) {
        if (n < mn) {
            return true;
        }
        n = (n - 1) / mn + 1;
    }
    for (int i = 0; i < maxes; ++i) {
        if (n < mx) {
            return true;
        }
        n = (n - 1) / mx + 1;
    }
    return n <= 1;
}

void solve() {
    int n, A;
    cin >> n >> A;
    int res = n;
    for (int x = 2; x <= 60; ++x) {
        int L = x - 1, R = 1e9;
        while (L + 1 < R) {
            int M = (L + R) / 2;
            int min_val = M / x;
            int max_val = min_val + 1;
            int maxes = M - min_val * x;
            int mins = x - maxes;
            if (more(min_val, mins, max_val, maxes, n)) {
                R = M;
            }
            else {
                L = M;
            }
            //cout << x << ' ' << L << ' ' << R << endl;
        }
        res = min(res, R + (x - 1) * A);
    }

    cout << res << "\n";
}
















































