#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define all(s) s.begin(), s.end()

const int inf = (int)1e6 + 7;

ll n, a, ans;

bool check (int x, int k) {
    ll u = 1;
    for (int i = 0; i <= k; i++) {
        u *= x;
        if (u >= n) return true;
    }
    return false;
}

int main() {
    scanf ("%lld %lld", &n, &a);
    ans = n;
    for (int i = 1; i <= 40; i++) {
        int l = 1, r = inf;
        ll x = i * a;
        while (r - l > 1) {
            int mid = (l + r) >> 1;
            if (check(mid, i)) {
                r = mid;
            } else {
                l = mid;
            }
        }
        ll u = 1;
        for (int j = 0; j <= i; j++) u *= l;
        x += (i + 1) * l;
        for (int j = 0; j <= i; j++) {
            u /= l;
            u *= r;
            x++;
            if (u >= n) break;
        }
        ans = min(ans, x);
    }
    cout << ans;
}
