{"raw_statement":[{"iden":"problem statement","content":"You are given an integer array $A=(a_1,a_2,\\ldots,a_N)$.  \nYou may perform the following operation any number of times (possibly zero).\n\n*   Choose a nonempty contiguous subarray of $A$, and delete it from the array.\n\nFor each $x=1,2,\\ldots,M$, solve the following problem:\n\n*   Find the minimum possible number of operations to make the sum of elements of $A$ equal $x$. If it is impossible to make the sum of elements of $A$ equal $x$, print `-1` instead.\n\nNote that the sum of elements of an empty array is $0$."},{"iden":"constraints","content":"*   $1 \\leq N,M \\leq 3000$\n*   $1 \\leq a_i \\leq 3000$\n*   All values in the input are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $M$\n$a_1$ $\\ldots$ $a_N$"},{"iden":"sample input 1","content":"4 5\n1 2 3 4"},{"iden":"sample output 1","content":"1\n2\n1\n1\n1\n\nThe followings are examples of minimum number of operations that achieve the goal.\n\n*   For $x=1$, delete $a_2,a_3,a_4$, and the sum of elements of $A$ becomes $x$.\n*   For $x=2$, delete $a_3,a_4$, then delete $a_1$, and the sum of elements of $A$ becomes $x$.\n*   For $x=3$, delete $a_3,a_4$, and the sum of elements of $A$ becomes $x$.\n*   For $x=4$, delete $a_1,a_2,a_3$, and the sum of elements of $A$ becomes $x$.\n*   For $x=5$, delete $a_2,a_3$, and the sum of elements of $A$ becomes $x$."},{"iden":"sample input 2","content":"1 5\n3"},{"iden":"sample output 2","content":"\\-1\n-1\n0\n-1\n-1"},{"iden":"sample input 3","content":"12 20\n2 5 6 5 2 1 7 9 7 2 5 5"},{"iden":"sample output 3","content":"2\n1\n2\n2\n1\n2\n1\n2\n2\n1\n2\n1\n1\n1\n2\n2\n1\n1\n1\n1"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}