boys are standing in a circle. They start counting themselves clockwise, starting from . As soon as the count reaches , the last boy counted leaves the circle, and they continue counting from the next boy, starting from again.
The last remaining boy wins.
Boys are numbered from to in clockwise order, starting from the boy from whom the counting originally started.
Can you determine the number of the last remaining boy in the circle?
The input contains two integers and (1 \le n, p \le 10^6).
Print one number — the original number of the last boy.
Example 1