#agc062c. [agc062_c]Mex of Subset Sum
[agc062_c]Mex of Subset Sum
Problem Statement
You are given an integer sequence of length : .
Find the smallest positive integers that satisfy the following condition.
- There is no non-empty (not necessarily contiguous) subsequence of whose elements sum to .
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the smallest positive integers satisfying the conditions in ascending order, separated by spaces.
Sample Input 1
3 3
1 2 5
Sample Output 1
4 9 10
The subsequences of are , and their respective sums are . Therefore, for , there are subsequences of whose elements sum to .
On the other hand, for , there is no subsequence of whose elements sum to .
Sample Input 2
20 10
324 60 1 15 60 15 1 60 319 1 327 1 2 60 2 345 1 2 2 15
Sample Output 2
14 29 44 59 74 89 104 119 134 149