n, k = map(int,input().split())
x = 0


for i in range(0,41):
    if n % k ** i != n:
        x += 1
    else:
        x = x
print(x) n, k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k x = 0 x 0 for i in range(0,41):
    if n % k ** i != n:
        x += 1
    else:
        x = x i range(0,41) range 0 41 if n % k ** i != n:
        x += 1
    else:
        x = x n % k ** i != n n % k ** i n k ** i k i n x += 1 x 1 x = x x x print(x) print x k = map(int,input().split()) map(int,input().split()) k n, k = map(int,input().split()) map(int,input().split()) n x = x x x x = 0 0 x x += 1 1 x
n, k = map(int,input().split())
x = 0


for i in range(0,41):
    if n % k ** i != n:
        x += 1
    else:
        x = x
print(x)