B - ロープの収納 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MiB

配点 : 300 点

問題文

高橋君は登山サークルに所属しており、活動で使用する長いロープの管理を担当しています。

サークルの倉庫には、長さ L センチメートルのロープが 1 本あります。このロープを収納ケースにしまうためには、ロープの長さを W センチメートル以下にする必要があります。

高橋君はロープを繰り返し二つ折りにすることで、収納ケースに収まる長さにしようと考えています。二つ折りとは、ロープ全体を半分の位置で折り返す操作です。現在の長さが x センチメートルのロープを 1 回二つ折りにすると、長さは \lceil x / 2 \rceil センチメートルになります。ここで \lceil y \rceil は y 以上の最小の整数(天井関数)を表します。これは、長さが奇数のときは折り目の位置がちょうど半分にならず、折り重なった 2 本のうち長い方の長さが全体の長さとなることに対応します。たとえば、長さが 7 のロープを二つ折りにすると長さは \lceil 7 / 2 \rceil = 4 に、長さが 8 のロープを二つ折りにすると長さは \lceil 8 / 2 \rceil = 4 になります。なお、折りたたんだことによる厚みは考慮しません。

ロープの長さを W センチメートル以下にするために必要な最小の折りたたみ回数を求めてください。最初から L \leq W であれば折りたたむ必要がないため、答えは 0 です。

制約

  • 1 \leq L \leq 10^{18}
  • 1 \leq W \leq 10^{18}
  • L, W は整数

入力

L W

ロープの長さを表す整数 L と、収納ケースに収まる長さの上限を表す整数 W が、スペース区切りで 1 行に与えられる。

出力

ロープの長さを W センチメートル以下にするために必要な最小の折りたたみ回数を 1 行で出力してください。


入力例 1

10 3

出力例 1

2

入力例 2

100 100

出力例 2

0

入力例 3

1000000000000000000 1

出力例 3

60

Score : 300 pts

Problem Statement

Takahashi belongs to a mountaineering club and is in charge of managing the long rope used for activities.

In the club's storage room, there is one rope of length L centimeters. To put this rope into a storage case, the rope's length must be reduced to W centimeters or less.

Takahashi plans to repeatedly fold the rope in half to make it short enough to fit in the storage case. Folding in half means folding the entire rope at its midpoint. When a rope of current length x centimeters is folded in half once, its length becomes \lceil x / 2 \rceil centimeters. Here, \lceil y \rceil denotes the smallest integer greater than or equal to y (the ceiling function). This corresponds to the fact that when the length is odd, the fold position is not exactly at the halfway point, and the length of the longer of the two overlapping parts becomes the overall length. For example, folding a rope of length 7 in half gives a length of \lceil 7 / 2 \rceil = 4, and folding a rope of length 8 in half gives a length of \lceil 8 / 2 \rceil = 4. Note that the thickness resulting from folding is not considered.

Find the minimum number of folds required to reduce the rope's length to W centimeters or less. If L \leq W from the beginning, no folding is necessary, so the answer is 0.

Constraints

  • 1 \leq L \leq 10^{18}
  • 1 \leq W \leq 10^{18}
  • L, W are integers

Input

L W

An integer L representing the length of the rope and an integer W representing the maximum length that fits in the storage case are given on a single line, separated by a space.

Output

Print the minimum number of folds required to reduce the rope's length to W centimeters or less, on a single line.


Sample Input 1

10 3

Sample Output 1

2

Sample Input 2

100 100

Sample Output 2

0

Sample Input 3

1000000000000000000 1

Sample Output 3

60