P10595 Xavier is Learning to Count

题目描述

集合 $S$ 内有 $m$ 个互异整数。请对于任意整数 $i$ 求出 $S$ 内满足大小为 $p$ 且元素和为 $i$ 的子集数量。

输入格式

There are multiple test cases. The number of them is given in the beginning of the input. Then a series of input block comes one by one. For each test case: The first line contains two space-separated integers $m$ and $p (1\leq p\leq 5)$. The second line contains $m$ distinct positive integers - the numbers written on each of the cards. None of these integers exceeds $13000$. There are about $120$ test cases in total, but $90\%$ of them are relatively small. More precisely, all numbers are less than or equal to $100$ in $90\%$ of the test cases.

输出格式

For each test case: For each positive integer, output the number of ways in a single line. To keep the output finite, only numbers with positive ways should be outputted. Output a blank line after each test case. See sample for more format details.