Experimenter#5434

Experimenter

1 second
64 megabytes
Hard

In his later years, a professor developed a keen interest in studying the durability of "KD521(2)" transistors. Unfortunately, he could not find any colleagues to assist him, so he decided to conduct the measurements by himself. However, this challenge did not discourage him.

The professor found transistors of the specified model in a cabinet, remnants from previous times, and decided to use them for his experiments.

After some thought, he devised the following measurement method: he plans to drop transistors from various floors while ascending a fire escape ladder. This will help him identify the lowest floor from which a transistor breaks when dropped. He is certain that a transistor will not survive a fall from the top floor, but it will remain undamaged if dropped from human height (that is, when he is on the first floor).

It is known that all transistors are identical, and if a transistor breaks when dropped from a certain floor, it will also break from any higher floor.

Transistors that break cannot be reused, but those that remain intact after a fall can be reused. To retrieve an intact transistor, the professor must descend to the first floor. Once there, he can collect all the transistors lying on the ground.

The professor is mindful of his age and wants to minimize the total distance he has to climb. However, age also brings wisdom — by removing his glasses, he can determine from any floor whether a transistor has broken.

Initially, the professor starts on the first floor with transistors. The building where he lives has floors.

Determine the minimum number of floors the professor will need to climb in the worst-case scenario during his experiments.

Input

The input file contains two integers — the height of the building (2 \leq n \leq 50) and the number of transistors (1 \leq m \leq 10).

Output

Output a single number — the minimum distance in floors that the professor will have to climb in the worst-case scenario during the experiment.

Examples

Example 1

Loading
Loading