import math

number,base=input().split()

num=int(number)

bas=int(base)

converted=0

reminder=0

i=0

#counter=0

while num!=0:

    reminder=num%bas

    num=num//bas

    converted=converted+reminder*10**i

    i+=1



#print(converted)

#To convert integer into string

y=str(converted)

print((len(y)))
import string

d = string.digits + string.ascii_letters





def con(x, base):

    if x < 0:

        sign = -1

    elif x == 0:

        return d[0]

    else:

        sign = 1

    x *= sign

    digits = []



    while x:

        digits.append(d[int(x % base)])

        x = int(x / base)



    if sign < 0:

        digits.append('-')

    digits.reverse()



    return ''.join(digits)

n,k = list(map(int,input().strip().split()))

v = con(n,k)

print((len(v)))

import math

number, base = input().split()
num = int(number)
bas = int(base)
converted = 0
reminder = 0
i = 0
# counter=0
while num != 0:
    reminder = num % bas
    num = num // bas
    converted = converted + reminder * 10**i
    i += 1
# print(converted)
# To convert integer into string
y = str(converted)
print((len(y)))

import string

d = string.digits + string.ascii_letters


def con(x, base):
    if x < 0:
        sign = -1
    elif x == 0:
        return d[0]
    else:
        sign = 1
    x *= sign
    digits = []
    while x:
        digits.append(d[int(x % base)])
        x = int(x / base)
    if sign < 0:
        digits.append("-")
    digits.reverse()
    return "".join(digits)


n, k = list(map(int, input().strip().split()))
v = con(n, k)
print((len(v)))

-import math +import string -number, base = input().split() -num = int(number) -bas = int(base) -converted = 0 -reminder = 0 -i = 0 -# counter=0 -while num != 0: -    reminder = num % bas -    num = num // bas -    converted = converted + reminder * 10**i -    i += 1 -# print(converted) -# To convert integer into string -y = str(converted) -print((len(y))) +d = string.digits + string.ascii_letters + + +def con(x, base): +    if x < 0: +        sign = -1 +    elif x == 0: +        return d[0] +    else: +        sign = 1 +    x *= sign +    digits = [] +    while x: +        digits.append(d[int(x % base)]) +        x = int(x / base) +    if sign < 0: +        digits.append("-") +    digits.reverse() +    return "".join(digits) + + +n, k = list(map(int, input().strip().split())) +v = con(n, k) +print((len(v)))