404690: GYM101611 A Advertising Strategy
Description
Recently you have been hired by a company that wished to remain unnamed to promote videos on its Itube channel. There are n users subscribed to this channel. The rules of video going viral are complicated: on the one hand, every day, the number of subscribers who have seen the video can double; on the other hand, at most half of all subscribers who haven't seen the video yet will watch it.
To promote a new video you have been assigned a budget of k burles. At the beginning of each day you can spend x burles to make x persons watch the video. Obviously, you are going to pick subscribers who haven't seen it yet. Each day you can choose different value of x, but the total number of burles spent can not exceed k. Formally, on the i-th day the following happens:
- Denote ai the number of subscribers who have seen the video so far. At the beginning of the day you spend xi burles, and now the number of subscribers who have seen the video is bi = ai + xi.
- During the day this number increases according to the rules described above, so .
You have already noticed that according to the rules above you will have to pay at least for the first person to see the video and for the last person. Now you wonder what is the minimum number of days required to make all n subscribers to see the video, assuming you can not spend more than k burles?
InputThe only line of the input contains two integers n and k (1 ≤ n ≤ 1018, 2 ≤ k ≤ 100 000) — the number of subscribers to the channel and the amount of money available (in burles).
OutputPrint one integer — the minimum number of days required to make all subscribers see the video.
ExamplesInput7 4Output
3Input
10 2Output
6Note
In the first sample, one of the optimal solutions is:
- Pay 1 burle at the beginning of the first day. At the end of the day the number of subscribers who have seen the video is 2.
- Pay 1 more burle to make b3 = 3, there will be 5 subscribers affected at the end of the day.
- Pay 2 burles to make everyone see the video.
In the second sample, you pay one burle at the beginning of the first day, then the number of subscribers who have seen the video changes as: 2, 4, 7, 8, 9, and then you pay to make the last subsribers see the video.