program digit
implicit none
integer n, k, ik
integer i
!
! input
read *, n, k
!
!
i=1
ik=1
do
  ik=k*ik
  if(n-ik>=0) then
    i = i + 1
  else
    exit
  end if
end do
!
! output
print '(i0)', i
end program