Xavier Is Learning to Count

No attempts yetTime limit5sMemory limit512 MB

Problem

Xavier, a 9-year-old student, loves all kinds of puzzles. One of his favourites is the following.

His classmate Xerier has made many cards. On each card she writes a single positive integer, and no two cards share the same number. She then writes down an equation whose right-hand side is a single positive integer $n$ of her choosing, and whose left-hand side is the sum of $p$ of the card values:

$$X_1 + X_2 + \cdots + X_p = n$$

Xavier must place $p$ cards on the positions $X_1, X_2, \dots, X_p$ so that the equation holds, with the extra condition that the chosen values appear in increasing order:

$$X_i < X_{i+1}, \quad 1 \le i < p$$

Because every card carries a distinct number, this is the same as choosing a set of $p$ different cards — there is exactly one way to arrange any chosen set in increasing order. For a value $n$ chosen by Xerier, Xavier wants to know how many solutions exist. Your task is to report, for every attainable sum $n$, the number of ways to form it.

Input

There are several test cases. The first line of the input contains the number of test cases $T$. The test cases then follow one after another.

Each test case consists of two lines:

  • The first line contains two space-separated integers $m$ and $p$ ($1 \le p \le 5$), where $m$ is the number of cards.
  • The second line contains the $m$ distinct positive integers written on the cards. None of these integers exceeds $13000$.

Output

For each test case, print the following:

  • First print Case #x:, where $x$ is the test-case number starting from $1$.
  • For every sum $n$ that can be obtained by choosing exactly $p$ of the cards, print the number of ways $w$ to obtain it on its own line, in the format n: w. List the sums $n$ in increasing order and print only sums that can be formed in at least one way, so that the output stays finite.
  • Print a blank line after each test case.