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

n = 0
x = 0

while True:
    x = K**n
    if x > N:
        n -= 1
        break
    n += 1

ans = []

for i in range(n, -1, -1):
    if K**i < N:
        ans.append(N//(K**i))
        N = N % (K**i)
    else:
        ans.append(0)

print(len(ans)) N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K n = 0 n 0 x = 0 x 0 while True:
    x = K**n
    if x > N:
        n -= 1
        break
    n += 1 True x = K**n x K**n K n if x > N:
        n -= 1
        break
     x > N x N n -= 1 n 1 break n += 1 n 1 ans = [] ans [] for i in range(n, -1, -1):
    if K**i < N:
        ans.append(N//(K**i))
        N = N % (K**i)
    else:
        ans.append(0) i range(n, -1, -1) range n -1 -1 if K**i < N:
        ans.append(N//(K**i))
        N = N % (K**i)
    else:
        ans.append(0) K**i < N K**i K i N ans.append(N//(K**i)) ans.append ans append N//(K**i) N K**i K i N = N % (K**i) N N % (K**i) N K**i K i ans.append(0) ans.append ans append 0 print(len(ans)) print len(ans) len ans ans = [] [] ans N, K = map(int, input().split()) map(int, input().split()) N n += 1 1 n N = N % (K**i) N % (K**i) N K = map(int, input().split()) map(int, input().split()) K x = K**n K**n x x = 0 0 x n = 0 0 n n -= 1 1 n
N, K = map(int, input().split())

n = 0
x = 0

while True:
    x = K**n
    if x > N:
        n -= 1
        break
    n += 1

ans = []

for i in range(n, -1, -1):
    if K**i < N:
        ans.append(N//(K**i))
        N = N % (K**i)
    else:
        ans.append(0)

print(len(ans))
