import math
n,k = map(int, input().split())

N = int(math.floor(math.log(n)/math.log(k)))+1
m = n
L = []
for i in range(N+1):
  L.append(m//(k**(N-i)))
  m = m%(k**(N-i))
  
if L[0] == 0:
  L.pop(0)

print(len(L)) import math math n,k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k N = int(math.floor(math.log(n)/math.log(k)))+1 N int(math.floor(math.log(n)/math.log(k)))+1 int(math.floor(math.log(n)/math.log(k))) int math.floor(math.log(n)/math.log(k)) math.floor math floor math.log(n)/math.log(k) math.log(n) math.log math log n math.log(k) math.log math log k 1 m = n m n L = [] L [] for i in range(N+1):
  L.append(m//(k**(N-i)))
  m = m%(k**(N-i))
   i range(N+1) range N+1 N 1 L.append(m//(k**(N-i))) L.append L append m//(k**(N-i)) m k**(N-i) k N-i N i m = m%(k**(N-i)) m m%(k**(N-i)) m k**(N-i) k N-i N i if L[0] == 0:
  L.pop(0) L[0] == 0 L[0] L 0 0 L.pop(0) L.pop L pop 0 print(len(L)) print len(L) len L n,k = map(int, input().split()) map(int, input().split()) n L = [] [] L m = n n m m = m%(k**(N-i)) m%(k**(N-i)) m N = int(math.floor(math.log(n)/math.log(k)))+1 int(math.floor(math.log(n)/math.log(k)))+1 N k = map(int, input().split()) map(int, input().split()) k
import math
n,k = map(int, input().split())

N = int(math.floor(math.log(n)/math.log(k)))+1
m = n
L = []
for i in range(N+1):
  L.append(m//(k**(N-i)))
  m = m%(k**(N-i))
  
if L[0] == 0:
  L.pop(0)

print(len(L))