eolymp
Competitions

Lesson 4. September 24 - 30. Loops: while statement

Yo-Yo

Toy yo-yo consists of a coil, which is wound a thread. If, holding the end of the thread to release the spool, it will be rotating, first drop down, and then by inertia to rise. But the height to which the coil will rise, will be k times less than the height from which she sank. We assume that the coil is stopped, if the height of another rise is less or equal than 1.

prb421

Write a program that the length of strings l and the coefficient k counts the number of ascents coil to stop. For example, let l = 17 and k = 2, then the coil will rise to the heights of 8.5, 4.25, 2.125, 1.0625, and then stops. So we get 4 lifts.

Input

Two integers l (1l109) and k (2k100).

Output

Print the number of ascents.

Time limit 1 second
Memory limit 128 MiB
Input example #1
17 2
Output example #1
4
Input example #2
1 2
Output example #2
0
Input example #3
59049 3
Output example #3
9