Game 1n (play1n)
Medium
Execution time limit is 0.1 seconds
Runtime memory usage limit is 64 megabytes
On a table in front of two players, there are k identical items (such as buttons). The players take turns, and during each turn, they must take either one button or n buttons from the table. Skipping a turn is not allowed. The winner is the player who forces their opponent to take the last button. Determine which player will win if both play optimally. The constraints are 3 <= n <= 6 and 1 <= k <= 100.
Input
Provide the values k and n on a single line.
Output
Print the number of the winning player.
Examples
Input #1
Answer #1
Submissions 271
Acceptance rate 17%