#K36992. Ball Passing Game
Ball Passing Game
Ball Passing Game
In a circle, there are n friends numbered from 1 to n. The game starts with friend 1 holding the ball. The ball is then passed sequentially from one friend to the next in a circular manner. The game stops as soon as the ball has been passed m times. Your task is to determine which friend will end up with the ball.
The position of the friend holding the ball can be determined by the formula $$((m - 1) \mod n)+1$$ where mod denotes the modulo operation.
inputFormat
The input consists of a single line that contains two positive integers n and m separated by a space, where n is the number of friends and m is the number of times the ball is passed.
outputFormat
Output a single integer, which is the number assigned to the friend holding the ball when the game terminates.## sample
5 3
3