/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
// Verified: https://judge.yosupo.jp/submission/8595

/*
 * How to use:

 LiChao<ll, true> seg(h);

 * h: sorted points (where to be queried)
 */
template<typename T, bool isMin>
struct LiChao {

    int N;
    static constexpr T INF = numeric_limits<T>::max();
    struct Line {
        T a, b;
        Line(T a, T b): a(a), b(b){}
        T get(T x){ return a*x + b;}
    };
    vector<T> pos;
    vector<Line> dat;

    LiChao(int n) {
      pos.resize(n);
      for(int i=0; i<n; i++) pos[i] = i;
      init(n);
    }
    LiChao(const vector<T> &pos):pos(pos){init(pos.size());}

    void init(int n) {
      N=1;
      while(N<n) N<<=1;
      while((int)pos.size() < N) {
        pos.emplace_back(T(pos.back())+1);
      }
      dat.resize(2*N, Line(0, -INF));
    }

    // Add ax + b
    void addLine(T a, T b) {
      if (isMin) a = -a, b = -b;
      update(1, 0, N, Line(a, b));
    }

    void update(int k, int l, int r, Line x) {
      T lb = pos[l], ub = pos[r];
      int med = (l + r) / 2;
      if (dat[k].get(pos[med]) < x.get(pos[med])) {
        swap(dat[k], x);
      }
      if (l + 1 == r) return;
      if (x.a < dat[k].a) {
        update(k * 2, l, med, x);
      } else if (x.a > dat[k].a) {
        update(k * 2 + 1, med, r, x);
      }
    }

    T query(T x) {
      auto t = distance(pos.begin(), lower_bound(pos.begin(), pos.end(), x));
      assert(0 <= t && t < (int)pos.size() && pos[t] == x);
      if (isMin) {
        return -query(0, N-1, t);
      } else {
        return query(0, N-1, t);
      }
    }

    T query(int l, int r, int t) {
      T ret = -INF;
      int k = t + N;
      while (k >= 1) {
        ret = max(ret, dat[k].get(pos[t]));
        k >>= 1;
      }
      return ret;
    }

};

class ECookies {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      ll n, a; cin >> n >> a;
      ll ret = n;
      for(int k=1; k<=40; k++) {
        ll ok = n;
        ll ng = 0;
        while(ng + 1 < ok) {
          ll med = (ng+ok)/2;
          bool flag = false;
          ll s = 1;
          for(int i=0; i<=k; i++) {
            if (s > n/med) {
              flag = true;
              break;
            }
            s *= med;
          }
          if (flag || s >= n) {
            ok = med;
          } else {
            ng = med;
          }
        }
        ll mi = 0; // possible ok - 1
        for(int j=1; j<=k; j++) {
          ll s = 1;
          rep(_, j) s *= (ok-1);
          rep(_, k+1-j) s *= ok;
          if (s >= n) mi = j;
        }
        //debug(a, n, k, ok, mi);
        chmin(ret, a*k + (k+1)*ok-mi);
      }
      cout << ret << endl;
    }
};

signed main() {
  ECookies solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 3660