There are N channels on your TV. The channels are arranged in such a manner that after the Nth channel, it again starts with the first one, and channels are numbered from 1 to N. More formally, moving from the ith channel brings you to the (i + 1)th channel for 1 ≤ i ≤ N, and moving clockwise from the Nth channel brings you to the 1st channel.
The rules for switching TV channels are as follows:
The Input consists of a single line:
Print a single number X denoting the channel number you are watching at the end (when only one channel is left).
Input: 5 2 Output: 3
Start at channel 1. Count 2 channels clockwise, which are channels 1 and 2. Channel 2 gets deleted. The next start is channel 3. Count 2 channels clockwise, which are channels 3 and 4. Channel 4 gets deleted. The next start is channel 5. Count 2 channels clockwise, which are channels 5 and 1. Channel 1 gets deleted. The next start is channel 3. Count 2 channels clockwise, which are channels 3 and 5. Channel 5 gets deleted. Only channel 3 is left. So, we will watch channel 3.