Stacking Haybales

Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 64M

Problem types
Allowed languages
C, C++, Haskell, Java, Python

Farmer John has bought exactly \(N\) hay bales with varying heights. Bessie, the foolish and milk laden cow, wishes the create a stack of hay bales that is exactly \(H\) meters tall. Can you help her by writing a program to determine whether this is possible?


The input will begin with a line containing a single integer \(T\) (\(0 \leq T \leq 100\)) , the number of test cases to follow. Each test case will begin with a line containing two integers \(N\) (\(0 \leq N \leq 25\)) and \(H\) (\(0 \leq H \leq 10^{10}\)), the number of hay bales and the target height that Bessie would like respectively. Then, each test case will contain a second line containing \(N\) space separated integers \(Hi\) (\(0 \leq Hi \leq 10^{10}\)), where \(Hi\) denotes the height in meters of the \(i\)th hay bale.


On a single line for each test case, output YAY if Bessie can achieve her goal, otherwise output NAY.

Sample Input

3 7
1 2 3
3 10
5 5 2

Sample Output



There are no comments at the moment.