Company: Walmart sparkplug
Difficulty: medium
Chemical Combination Analysis Dr. Evelyn aims to prepare an exact chemical solution with a mass of M grams by choosing from N distinct chemical substances, each with a known mass W[i] in grams. Her goals are: Determine whether a subset of these substances can be selected such that their combined mass precisely equals M grams. From any subset whose total mass equals M grams, identify all possible smaller masses that can be achieved by forming different combinations from the same substances. Note: All mass values are positive integers, and it's guaranteed that at least one combination of substances has a total mass of M grams. Input Format The first line consists of two integers N and M representing the number of accessible chemical substances and the required mass. The second line contains N space-separated integers W[1], W[2],..., W[N] representing weight of the i-th chemical substance available. Output Format In the first line, print a positive integer representing the number of disti