404690: GYM101611 A Advertising Strategy

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Advertising Strategytime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

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:

  1. 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.
  2. 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?

Input

The 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).

Output

Print one integer — the minimum number of days required to make all subscribers see the video.

ExamplesInput
7 4
Output
3
Input
10 2
Output
6
Note

In the first sample, one of the optimal solutions is:

  1. 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.
  2. Pay 1 more burle to make b3 = 3, there will be 5 subscribers affected at the end of the day.
  3. 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.

加入题单

算法标签: