题目描述
Problem Description
One day, CC bought \( N \) bottles with an infinite capacity. Initially, each bottle contains 1 liter of water. CC realized that there were too many bottles, so he decided to keep no more than \( K \) bottles. Each time, he chooses two bottles with the same amount of water, pours all the water from one bottle into the other, and then discards the empty bottle (he cannot discard bottles with water).
Obviously, in some cases, CC cannot achieve his goal, such as when \( N = 3 \) and \( K = 1 \). In such cases, CC will buy some new bottles (new bottles have infinite capacity and start with 1 liter of water) to achieve his goal.
Now, CC wants to know the minimum number of new bottles he needs to buy to achieve his goal.
Input Format
A line containing two positive integers \( N \) and \( K \) (\( 1 \le N \le 2 \times 10^9 \), \( K \le 1000 \)).
Output Format
A non-negative integer representing the minimum number of new bottles needed.
Sample Input and Output
Sample Input #1
3 1
Sample Output #1
1
Sample Input #2
13 2
Sample Output #2
3
Sample Input #3
1000000 5
Sample Output #3
15808
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分