- All Contests
- ProjectEuler+
- Project Euler #201: Subsets with a unique sum

# Project Euler #201: Subsets with a unique sum

# Project Euler #201: Subsets with a unique sum

_{This problem is a programming version of Problem 201 from projecteuler.net}

For any set of numbers, let be the sum of the elements of .

Consider the set .

There are 20 subsets of B containing three elements, and their sums are:

Some of these sums occur more than once, others are unique.

For a set , let be the set of unique sums of subsets of , in our example we find and .

Now consider the -element set .

has -element subsets.

Determine the sum of all integers which are the sum of exactly one of the -element subsets of , i.e. find .

**Input Format**

First line of input contains two integers and . Second line of input contains integers .

**Constraints**

- ,
- ,
- .

**Output Format**

Print one integer containing answer to the problem.

**Sample Input**

```
6 3
1 3 6 8 10 11
```

**Sample Output**

```
156
```