n,k=[int(s) for s in input().split()]

r=[]
i=0
a=0
while n>0:
  i=n%k
  n=n-i
  n=n//k
  r.append(i)
  a=a+1
  

print(a) int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s n,k=[int(s) for s in input().split()] n [int(s) for s in input().split()] k r=[] r [] i=0 i 0 a=0 a 0 while n>0:
  i=n%k
  n=n-i
  n=n//k
  r.append(i)
  a=a+1
   n>0 n 0 i=n%k i n%k n k n=n-i n n-i n i n=n//k n n//k n k r.append(i) r.append r append i a=a+1 a a+1 a 1 print(a) print a n=n//k n//k n a=a+1 a+1 a a=0 0 a n,k=[int(s) for s in input().split()] [int(s) for s in input().split()] n k=[int(s) for s in input().split()] [int(s) for s in input().split()] k i=n%k n%k i r=[] [] r n=n-i n-i n i=0 0 i
n,k=[int(s) for s in input().split()]

r=[]
i=0
a=0
while n>0:
  i=n%k
  n=n-i
  n=n//k
  r.append(i)
  a=a+1
  

print(a)