| ASU Coding Cup 10 |
|---|
| Закончено |
There is A huge cage in ASZoo that can contain up to $$$k$$$ animals.
There are $$$n$$$ families of animals, each of which has an infinite family members, and each kind of animal weighs $$$a_i$$$ ($$$1 \le i \le n$$$).
The zookeeper decided to put exactly $$$k$$$ animals in the cage, regardless of the kind or the weight. The zookeeper can put more than one animal of the same family in the cage, and can also discard an entire family and not putting them in the cage.
Find all possible total weights of animals that the zookeeper can put in the cage.
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1000$$$).
The second line contains $$$n$$$ integers $$$a_1, a_2, ..., a_n$$$ ($$$1 \le a_i \le 1000$$$).
Print the only line with all the possible total weights of stolen products, separated by a space. The numbers should be printed in ascending order.
3 21 2 3
2 3 4 5 6
5 51 1 1 1 1
5
3 33 5 11
9 11 13 15 17 19 21 25 27 33
| Название |
|---|


