eolymp
bolt
Try our new interface for solving problems
Problems

Meet in the Middle

Meet in the Middle

You are given an array of $n$ numbers. In how many ways can you choose a subset of the numbers with sum $x$? \InputFile The first line has two numbers $n\:(1 \le n \le 40)$ and $x\:(1 \le x \le 10^9)$: the array size and the required sum. The second line has $n$ integers $t_1, t_2,..., t_n\:(1 \le t_i \le 10^9)$: the numbers in the array. \OutputFile Print the number of ways you can create the sum $x$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
4 5
1 2 3 2
Output example #1
3