s, k = map(int,input().split())
c = []
while s > 0:
    a = s % k
    c.append(a)
    s //= k

print(len(c)) s, k = map(int,input().split()) s map(int,input().split()) map int input().split() ().split () input split k c = [] c [] while s > 0:
    a = s % k
    c.append(a)
    s //= k s > 0 s 0 a = s % k a s % k s k c.append(a) c.append c append a s //= k s k print(len(c)) print len(c) len c k = map(int,input().split()) map(int,input().split()) k s //= k k s s, k = map(int,input().split()) map(int,input().split()) s a = s % k s % k a c = [] [] c
s, k = map(int,input().split())
c = []
while s > 0:
    a = s % k
    c.append(a)
    s //= k

print(len(c))
