SDE Path

Count Subsets with Given Sum

Medium

Count Subsets with Given Sum

Count the number of subsets of an array that sum to a given target.

Input format

The first line contains N (≤15) and TARGET. The second line contains N integers (0–20).

Output format

Print the count of subsets that sum to TARGET.

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
1 95
19
Expected output
0
Example 2
Input
11 87
10 16 13 0 20 15 0 16 1 20 13
Expected output
20