def func(x,n):

    if int(x/n):

        return func(int(x/n),n)+str(x%n)

    return str(x%n)    



N,K=list(map(int,input().split()))

print((len(func(N,K))))
N,K = list(map(int,input().split()))

cnt = 0

while N > 0:

    N //= K

    cnt += 1

print(cnt)
def func(x, n):
    if int(x / n):
        return func(int(x / n), n) + str(x % n)
    return str(x % n)


N, K = list(map(int, input().split()))
print((len(func(N, K))))

N, K = list(map(int, input().split()))
cnt = 0
while N > 0:
    N //= K
    cnt += 1
print(cnt)

-def func(x, n): -    if int(x / n): -        return func(int(x / n), n) + str(x % n) -    return str(x % n) - - -print((len(func(N, K)))) +cnt = 0 +while N > 0: +    N //= K +    cnt += 1 +print(cnt)