{"problem":{"name":"mod M Game","description":{"content":"There are $2N$ integers $A_1, A_2, ..., A_{2N}$ written on a blackboard, and an integer $M$ at least $2$.   Alice and Bob will play a game. They will alternately perform the following operation, with ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc148_d"},"statements":[{"statement_type":"Markdown","content":"There are $2N$ integers $A_1, A_2, ..., A_{2N}$ written on a blackboard, and an integer $M$ at least $2$.  \nAlice and Bob will play a game. They will alternately perform the following operation, with Alice going first, until there is no number on the blackboard.\n\n*   Choose a number and delete it from the blackboard.\n\nAt the end of the game, if the sum of numbers deleted by Alice modulo $M$ equals the sum of numbers deleted by Bob modulo $M$, Bob wins; otherwise, Alice wins.  \nWhich player will win if both plays optimally?\n\n## Constraints\n\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $2 \\leq M \\leq 10^9$\n*   $0 \\leq A_i \\leq M - 1$\n*   All values in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1$ $A_2$ $\\dots$ $A_{2N}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc148_d","tags":[],"sample_group":[["2 9\n1 4 8 5","Alice\n\nThe game may proceed as follows.\n\n*   Alice deletes $1$.\n*   Bob deletes $4$.\n*   Alice deletes $5$.\n*   Bob deletes $8$.\n\nIn this case, the sum of numbers deleted by Alice modulo $M$ is $(1 + 5) \\bmod 9 = 6$, and the sum of numbers deleted by Bob modulo $M$ is $(4 + 8) \\bmod 9 = 3$. Since $6 \\neq 3$, Alice wins."],["3 998244353\n1 2 3 1 2 3","Bob"]],"created_at":"2026-03-03 11:01:14"}}