main = do
    line<-getLine
    let n = head [read x::Int| x<- words line]
    let k = last [read x::Int| x<- words line]
    print $ length $num2kdig n k

num2kdig :: Int -> Int ->[Int]
num2kdig 0 k = []
num2kdig n k = (mod n k) : num2kdig (div n k) k
