Problems

# Factorial

Factorials of natural numbers N (denoted N!) is the product of all integers from 1 to N, inclusive:N! = 1×2×3××N.

Required to determine how many digits "0" end record number N!in K-ary number system.

Input

In the input file contains two numbers:NandK(1N109, 2K5000).Both numbers are written in decimal notation.

Output

In the output file to bring the number of zeros, which in the K-ary number system ends with the number N!. Number of output in the decimal system.

Time limit 1 second
Memory limit 64 MiB
Input example #1
10000  10

Output example #1
2499