import java.util.Scanner

/**
 * Created by sonetsuyoshi on 2015/12/16.
 */
object Main extends App {
  val sc = new Scanner(System.in)

  val N = sc.nextLong
  val A = sc.nextLong


  var curTime = N

  def calc(eatCount: Long, minTime: Long): Long = {
    val time1 = math.pow(N, 1.0 / (eatCount + 1)).toLong
    val time2 = (time1 + 1).toLong

    var countTime1 = eatCount + 1
    var countTime2 = 0
    while(math.pow(time1, countTime1) * math.pow(time2, countTime2) < N) {
      countTime1 -= 1
      countTime2 += 1
    }

    val newTime = time1 * countTime1 + time2 * countTime2 + eatCount * A
    if(newTime < minTime) calc(eatCount + 1, newTime)
    else minTime
  }

  val t = calc(1, N)

  println(math.min(N, t))
}