#include <bits/stdc++.h>

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

//using namespace __gnu_pbds;
using namespace std ;

typedef pair<int, int> pi ;
//typedef tree< pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const i64 mod = 1000000007LL ;
#define INF 2000000000001LL
#define maxn 200005

/*
     *os.find_by_order(k) -> returns the k'th smallest element (indexing starts from 0)
      os.order_of_key(v)  -> returns how many elements are strictly smaller than v
*/

struct Line{
    i64 m , c , id ;
    i64 f(i64 x){ return x*m + c ; }
    i64 iSect( Line other ) {
         // floored division
         i64 a = c - other.c , b = other.m - m ;
		return a / b - ((a ^ b) < 0 && a % b);
    }
    bool operator<(const Line& o)const{
        return mp(c,id) < mp(o.c,o.id) ;
    }
};

//for minimization
// slope increasing , query point increasing

struct chtLinear{

    deque <Line> dq ;

    void addLine( i64 m  , i64 c , i64 id )
    {
        if( !dq.empty() && dq.back().m == m ) dq.back() = max( dq.back() , {m,c,id} ) ;
        else dq.push_back( {m,c,id} ) ;

        Line l = dq.back() ; dq.pop_back() ;
        int sz = dq.size() ;

        while( sz >= 2 && l.iSect(dq[sz-1]) <= dq[sz-1].iSect(dq[sz-2]) )
        {
            dq.pop_back() ;
            sz-- ;
        }
        dq.push_back(l) ;

/*        if( !dq.empty() && m==dq.front().m ) dq[0] = min( dq[0] , {m,c,id} ) ;
        else dq.push_front( {m,c,id} ) ;
        Line l = dq[0] ; dq.pop_front() ;
        while( (int)dq.size() >= 2 && l.iSect(dq[0]) > dq[0].iSect(dq[1]) ) dq.pop_front() ;
        dq.push_front(l) ; */
     }

    i64 f(i64 x)
    {
     //   printf("-- %d %lld\n",dq.size(),dq.front().m) ;
        while( (int)dq.size() > 1 && dq[0].f(x) <= dq[1].f(x) ) dq.pop_front() ;
        return dq[0].f(x) ;
    }

/*    pair<i64,i64> f(i64 x)
    {
        while( (int)dq.size() > 1 && dq[0].f(x) >= dq[1].f(x) ) dq.pop_front() ;
        return mp( dq[0].id , dq[0].f(x) ) ;
    } */
}ch;

int mxDays = 2000000 ;
int mxRestart = 45 ;

i64 dp[47][2000005] ;

int main()
{
    for(int i=0 ; i<=mxDays ; i++) dp[0][i] = i ;

    for(int i=1 ; i<=mxRestart ; i++)
    {
        ch.dq.clear() ;

        ch.addLine( dp[i-1][i-1] , -(i-1)*dp[i-1][i-1] , 0 ) ;

        for(int j=i ; j<=mxDays ; j++)
        {
            dp[i][j] = ch.f( j ) ;
            dp[i][j] = min(dp[i][j],INF) ;

            if(dp[i][j] >= INF)
            {
//                printf("%d --- %d\n",i,j) ;
                break ;
            }
            ch.addLine( dp[i-1][j] , -j*dp[i-1][j] , j ) ;
        }
    }
/*
    for(int i=0 ;i<=6 ; i++)
    {
        for(int j=1 ; j<=20 ; j++) printf("%d %d : %lld\n",i,j,dp[i][j]) ;
    }
*/
    i64 n , a ;

    scanf("%lld %lld",&n,&a) ;

    i64 ans = n ;

    for(int i=0 ; i<=mxRestart ; i++)
    {
        for(int j=1 ; j<=mxDays ; j++)
        {
            if( dp[i][j] >= n )
            {
                ans = min( ans , j + a*i ) ;
                break ;
            }
        }
    }

    printf("%lld\n",ans) ;

    return 0 ;
}


Measured memory_bytes: 121868