Subin is playing hide and seek with his younger brother. Subin is at point N and his brother is at point K. Subin can walk or teleport.
When Subin is at point X and walks, he arrives at X−1 or X+1 one second later. When he teleports, he arrives at 2X with no time passing. A position after a move must be at least 0, and there is no upper limit.
Given both positions, write a program that computes the earliest time, in seconds, at which Subin reaches his brother.