You are given a set of integers. You may choose distinct elements from this set to form a group. Two groups are considered different if there exists at least one element that is present in one group but not in the other. For example, if the set contains elements a, b, c, d, and you are asked to choose two elements, then ab, ac, ad, bc, bd, and are all valid and distinct groups.
A grouping system is called complete if, for a given , the number of different groups is maximized. In this example, the set \{ab, ac, ad, bc, bd, cd\} forms a complete grouping system.
For a particular complete grouping system, the fitness is computed as follows:
Each group contributes the product of all numbers in that group;
All group contributions are summed;
The fitness is defined as the total contribution , where is the bounding parameter.
In the example above, for k = 2, the fitness is
If k = 1, the fitness is
Your task is to determine the complete grouping system that yields the maximum possible fitness.
Each test case starts with two positive integers n~(2 \le n \le 1000) and m~(1 \le m < 2^{31}). The next line contains positive integers, each at most . The last test case contains n = m = 0 and should not be processed.
For each test case, print a single line containing the maximum possible fitness for a grouping system.
Example 1