Student Misha became interested in card tricks, but unfortunately, he never managed to learn professional card shuffling. Since he is studying programming, he came up with the following algorithm for shuffling a deck of cards:
For example, if we have a deck of $$$10$$$ cards numbered from $$$0$$$ to $$$9$$$, shuffling them into $$$3$$$ piles will get the following order: (from top to bottom) " 9, 6, 3, 0, 7, 4, 1, 8, 5, 2 ":
| Before mixing | Pile 1 | Pile 2 | Pile 3 | After mixing |
| 0 | 9 | |||
| 1 | 6 | |||
| 2 | 3 | |||
| 3 | 0 | |||
| 4 | 7 | |||
| 5 | 4 | |||
| 6 | 9 | 1 | ||
| 7 | 6 | 7 | 8 | 8 |
| 8 | 3 | 4 | 5 | 5 |
| 9 | 0 | 1 | 2 | 2 |
Trying to improve the shuffling, Misha applied this algorithm several times in a row and, to his surprise, found that consistent application of this algorithm always brings the cards back to their original order in the end. Only the number of applications of the algorithm depends on the number of initial cards $$$n$$$ and the number of piles $$$k$$$ used when everything returns to its original order. If $$$n = k$$$, then the order of the cards does not change at all.
To shuffle cards well, Misha wants to determine what minimum number of applications of the algorithm with $$$k$$$ piles a deck of $$$n$$$ cards will return to its original order.
A single line contains two integers $$$n$$$ ($$$1 \le n\le 800$$$) and $$$k$$$ ($$$1 \le k \le n$$$), separated by a space – the number of cards in Misha's deck and the number of piles in the algorithm, respectively.
In a single line, print the number – the minimum number of consecutive applications of the algorithm, after which the cards will return to their original order.
10 3
4