LearnPy Hub
← Arena
IntermediateRating 1300

Broken Calculator

A calculator shows x. It can only double the number or subtract 1. Print the fewest operations to show y.

Input

Two integers x and y (1 ≤ x, y ≤ 10⁹).

Output

One integer.

Sample 1

Input
2 3
Output
2

Sample 2

Input
5 8
Output
2
solution.py
Output appears here
Broken Calculator · Python Arena problem · LearnPy Hub