eolymp
bolt
Try our new interface for solving problems

ATM

In some country in circulation there are notes of certain denominations. National Bank wants the cash machine to give out any requested amount with a minimum number of banknotes, considering that the amount of banknotes of each denomination is unlimited. Help the National Bank to solve this problem. \InputFile First line contains the number of banknotes denominations in circulation $n$ $(n ≤ 100)$. Second line contains $n$ different positive integers $x_1, x_2, ..., x_n$ not greater than $10^6$ - the banknotes denominations. Third line contains the sum $s$ $(s ≤ 10^6)$ that you want to give. \OutputFile Print in the first line the minimal number of summands (or $-1$ if such representation does not exist). In the second line print these summands in any order.
Time limit 1 second
Memory limit 128 MiB
Input example #1
5
1 3 7 12 32
40
Output example #1
3
32 7 1