In front of .
lies a red button, a blue button, and a number. When clicks the red button, the number in front of him is subtracted by 1. When he clicks the blue button, the number in front of him is multiplied by 2. The number will initially start as. What is the minimum number of times has to click either buttons to get from ?
wants to get the numberInput Specification
The first and only line of input will contain 2 integers, and (.
Output Specification
Print a single number - the minimum number of times from .
needs to push the buttons in order to getSample Input 1
4 6
Sample Output 1
2
Explanation: Push the red button once, then the blue button once.
Sample Input 2
10 1
Sample Output 2
9
Explanation: Click the red button 9 times.
Comments