n,k = map(int,input().split())
l = []
while n != 0 :
    r = divmod(n,k)
    n = r[0]
    l.append(r[1])
print(len(l)) n,k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k l = [] l [] while n != 0 :
    r = divmod(n,k)
    n = r[0]
    l.append(r[1]) n != 0 n 0 r = divmod(n,k) r divmod(n,k) divmod n k n = r[0] n r[0] r 0 l.append(r[1]) l.append l append r[1] r 1 print(len(l)) print len(l) len l n,k = map(int,input().split()) map(int,input().split()) n n = r[0] r[0] n l = [] [] l r = divmod(n,k) divmod(n,k) r k = map(int,input().split()) map(int,input().split()) k
n,k = map(int,input().split())
l = []
while n != 0 :
    r = divmod(n,k)
    n = r[0]
    l.append(r[1])
print(len(l))