{"raw_statement":[{"iden":"problem statement","content":"You are given positive integers $N$ and $L$, and a sequence of positive integers $A = (A_{1}, A_{2}, \\dots , A_{N})$ of length $N$.\nFor each $i = 1, 2, \\dots , N$, answer the following question:\n\n> Determine if there exists a sequence of $L$ non-negative integers $B = (B_{1}, B_{2}, \\dots, B_{L})$ such that $\\displaystyle \\sum_{j = 1} ^ {L - 1} \\sum_{k = j + 1} ^ {L} |B_{j} - B_{k}| = A_{i}$. If it exists, find the minimum value of $\\max(B)$ for such a sequence $B$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2 \\times 10^{5}$\n*   $2 \\leq L \\leq 2 \\times 10^{5}$\n*   $1 \\leq A_{i} \\leq 2 \\times 10^{5}$\n*   All input values are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $L$\n$A_{1}$ $A_{2}$ $\\cdots$ $A_{N}$"},{"iden":"sample input 1","content":"2 4\n10 5"},{"iden":"sample output 1","content":"3\n-1\n\nFor $A_{1} = 10$, if we take $B = (1, 0, 2, 3)$, then $\\displaystyle \\sum_{j = 1} ^ {L - 1} \\sum_{k = j + 1} ^ {L} |B_{j} - B_{k}| = 10$, where $\\max(B) = 3$. No non-negative integer sequence $B$ satisfies the condition with $\\max(B) < 3$, so print $3$ in the first line.\nFor $A_{2} = 5$, there is no non-negative integer sequence $B$ that satisfies the condition, so print `-1` in the second line."},{"iden":"sample input 2","content":"6 8\n167 924 167167 167924 116677 154308"},{"iden":"sample output 2","content":"11\n58\n10448\n10496\n7293\n9645"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}