The Game of Pebbles#6276

The Game of Pebbles

1 second
64 megabytes
Very easy

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 .

Input

The input consists of two integers, and , where 1 \le N, M \le 1000.

Output

Output the number of stones you should take to guarantee a win, or if no winning strategy exists.

Examples

Example 1

Loading
Loading