Problem Description

n people are standing in a circle (1..n). Starting from 1, every k-th person is removed. Print the winner position.

Input Format

One line: n k.

Output Format

One integer winner.

Sample Test Case

Input:
7 3
Output:
4

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next