The Archery Puzzle

Here is an odd little puzzle which occurred the other day at an archery meeting. The young lady who carried of the frst prize scored exactly one hundred points. Can you fgure out how many arrows she used, as well as the points awarded to each arrow? You will receive a list of N positive integers, P1, P2, ..., PN , which represent the scores in the archery target; that is, the diferent scores that can be achieved with a single hit. You will also receive an integer S, which is the total score that is to be obtained. The young archer scored 100 points Determine the minimum number of arrows necessary to score S points, and print the points awarded to each of those arrows, sorted in descending order. If there is more than one group of arrows that provide a valid solution, choose the solution for which the frst arrow scores the highest amount of points; if the solution is still not unique, then choose one in which the second arrow scores the highest score possible, and keep applying this reasoning for the rest of the arrows. Input Input starts with a positive integer T, that denotes the number of test cases. Each test case starts with two integers in a single line: N and S. The second line for each test case contains N integers in ascending order: P1, P2, ..., PN. T≤500;1≤N≤50;1≤P1<P2<P3<...<PN ≤S≤300 Output For each test case, print the case number, followed by the minimum number of arrows required to score S points between square brackets, and then the sequence of points for each arrow, in descending order. These scores must be separated by single spaces. If the test case does not have a solution, simply print the case number, followed by the string ‘impossible’. Sample Input 3 6 100 16 17 23 24 39 40 3 50 10 15 20 2 25 7 13 Sample Output Case 1: [6] 17 17 17 17 16 16 Case 2: [3] 20 20 10

2/2 Case 3: impossible