There is a pile of stones. Two players alternate turns, and on each turn, a player must take between one and stones, inclusive. The player who cannot make a move loses the game.
If you are the first player and want to ensure a win, how many stones should you take on your first turn? If winning is not possible, return .
The input consists of two integers, and , where 1 \le N, M \le 1000.
Output the number of stones you should take to guarantee a win, or if no winning strategy exists.
Example 1