{"raw_statement":[{"iden":"problem statement","content":"There are $N$ cards in a box. Each card has an integer written on it, which is between $1$ and $M$, inclusive. For each $i=1,\\ldots,M$, there are $C_i$ cards with the number $i$ written on them.\nStarting with an empty notebook, you repeat the following operation:\n\n*   Randomly draw one card from the box. Write the integer on the card in the notebook, then return the card to the box.\n\nFind the expected value, modulo $998244353$, of the number of times the operation is performed until the notebook has all integers from $1$ to $M$ written at least once.\nHow to find an expected value modulo $998244353$ The expected value sought in this problem can be proven to always be a rational number. Furthermore, the constraints of this problem guarantee that when the expected value is expressed as an irreducible fraction $\\frac yx$, the denominator $x$ is not divisible by $998244353$. Then, there is a unique $0\\leq z\\lt998244353$ such that $y\\equiv xz\\pmod{998244353}$. Print this $z$."},{"iden":"constraints","content":"*   $1 \\leq M \\leq N \\leq 2\\times 10^5$\n*   $1 \\leq C_i$\n*   $\\sum_{i=1}^{M}C_i=N$\n*   All input values are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $M$\n$C_1$ $\\ldots$ $C_M$"},{"iden":"sample input 1","content":"2 2\n1 1"},{"iden":"sample output 1","content":"3\n\nThe series of operations may proceed as follows:\n\n*   You draw a card with $1$ written on it. The notebook now has one $1$ written in it.\n*   You again draw a card with $1$ written on it. The notebook now has two $1$s written in it.\n*   You draw a card with $2$ written on it. The notebook now has two $1$s and one $2$ written in it.\n\nThe sought expected value is $2\\times\\frac{1}{2}+3\\times\\frac{1}{4}+4\\times\\frac{1}{8}+\\ldots=3$."},{"iden":"sample input 2","content":"5 2\n4 1"},{"iden":"sample output 2","content":"748683270\n\nThe expected value is $\\frac{21}{4}$, whose representation modulo $998244353$ is $748683270$."},{"iden":"sample input 3","content":"50 50\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},{"iden":"sample output 3","content":"244742906\n\nThe expected value is $\\frac{13943237577224054960759}{61980890084919934128}$."},{"iden":"sample input 4","content":"74070 15\n1 2 3 11 22 33 111 222 333 1111 2222 3333 11111 22222 33333"},{"iden":"sample output 4","content":"918012973"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}