AtCoder Grand Contest 062
C
Mex of Subset Sum
AtCoder
⌀ 2320
原题
← BD →
翻译中…

Problem Statement

翻译中…

You are given an integer sequence of length $N$: $A=(A_1,A_2,\dots,A_N)$.

翻译中…

Find the $K$ smallest positive integers $X$ that satisfy the following condition.

翻译中…
  • There is no non-empty (not necessarily contiguous) subsequence of $A$ whose elements sum to $X$.
翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 60$
  • $1 \leq K \leq 1000$
  • $1 \leq A_i \leq 10^{15}$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N K
A_1 A_2 \dots A_N

翻译中…

Output

翻译中…

Print the $K$ smallest positive integers satisfying the conditions in ascending order, separated by spaces.

翻译中…

样例

Input #1
3 3
1 2 5
Output #1
4 9 10
The subsequences of $A$ are $(1),(2),(1,2),(5),(1,5),(2,5),(1,2,5)$, and their respective sums are $1,2,3,5,6,7,8$. Therefore, for $X=1,2,3,5,6,7,8$, there are subsequences of $A$ whose elements sum to $X$. On the other hand, for $X=4,9,10$, there is no subsequence of $A$ whose elements sum to $X$.
Input #2
20 10
324 60 1 15 60 15 1 60 319 1 327 1 2 60 2 345 1 2 2 15
Output #2
14 29 44 59 74 89 104 119 134 149
题目信息
题号
agc062_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。