The Game of Lim
In the ancient game of Lim, two aliens take turns removing sticks from a pile with \(N\) sticks. On each turn, the current player must chose to remove at least \(1\) but no more than \(K\) sticks from the pile. Today, we will play the "misère" variation of Lim, where the last alien to take a stick loses.
Input Specification
The input will contain two space-separated integers \(N\) \((1 \le N \le 10^{18})\) and \(K\) \((1 \le K \le 12)\).
Output Specification
Output YES
if the first alien is guaranteed to win if they play perfectly. Otherwise, output NO
.
Constraints
Subtask 1 [40%]
\(N \le 30\)
Subtask 2 [40%]
\(N \le 10^6\)
Subtask 3 [20%]
No additional constraints.
Sample Input 1
2 9
Sample Output 1
YES
Explanation for Sample Output 1
The first alien can simply take \(1\) stick and force the second player to take the last.
Sample Input 2
21 3
Sample Output 2
NO
Comments