Josephus’s Problem talks about the problem where there are people standing in a circle waiting to be awarded the cash prize. The counting out begins at point 1 in the circle and proceeds around the circle in a fixed direction. In each step, a certain number of people are skipped and the last skipped person is awarded. The elimination proceeds around the circle(which is becoming smaller and smaller as the awarded people are removed). Until only the last person remains, who is not being awarded the cash prize.
Input Format:
The input consists of the number of persons(n) to be in the circle, followed by elimination count(m).
Output Format:
The output consists of a person, who is given freedom.
Example:
Input:
14 2
Output:
13