import io.StdIn._

object Main extends App {

  val line = readLine.split(" ").map(_.toInt)
  val N = line(0) // >= 1 && <= 10^9
  val K = line(1) // >= 2 && <= 10

  // 2 ^ 40 = 1,099,511,627,776
  val A = Range(1, 41).find { i =>
    N <= math.pow(K, i) - 1
  }

  println(A.get)
}
