Coconut Splat

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Coconut Splat is one of Theta's favorite counting-out games. It goes like this: initially, all players stand in a circle with their hands folded together (like an intact coconut).  In clockwise order, one player touches the hands of the other players and says the rhyme: "Co-co-nut, Co-co-nut, Co-co-nut, Splat!"  At each syllable, the player touches a hand, and the player whose hand or hands is touched last takes one of the following actions:

  • If the player's hands are still folded, they are split into two fists (the coconut is cracked in two halves). The next round starts with the fist that is the first half of the coconut, then the second half, then going to the next player.
  • If a fist is touched last, the hand is turned palm down (the milk spills out). The next round starts with the next hand in clockwise order, which could be the other hand  of the same player, or it could be the hand or folded hands belonging to the next player.
  • If a hand that is already turned palm down is touched last, the player to whom it belongs puts the hand behind their back and this hand won't be counted in the following rounds. The next round starts with the next hand in clockwise order as in the previous case.
  • If a player has put both of their hands behind their back, that player is out of the game.  The game ends when there is only one player left.

The hand or hands of the player doing the counting are taken into account (for instance, the counting player touches their thigh when it would be her turn to be touched).

There are variations of this game, for instance, some kids say "Coconut, coconut, crack your nut!" instead, which has only 99 instead of 1010 syllables.

There are nn players, and counting always starts with the folded hands of player 11. For instance, in the first round, if the rhyme has 33 syllables, player 33 would be the one to first crack their coconut into two fists.

Write a program that determines the winner of the counting-out game based on the number of players and based on the number of syllables in the rhyme that is used!

입력

The input consists of a single test case with two numbers ss (0<s1000 < s \le 100) and nn (2n1002 \le n \le 100) denoting the number of syllables in the rhyme and the number of players, respectively.

출력

Output a single integer pp (1pn1 \le p \le n), the number of the player who is left.