Sisters and coins
##### Submissions: 2756   Accuracy: 13.08%   Difficulty: Medium   Marks: 4

Mila and Gila are sisters, Mila being the younger one. Mila and Gila both have some number of coins of different denominations with them. Mila being a stubborn little sister won’t share her coins with anyone but wants that both of the sisters have equal money. Gila being an understanding elder sister accepts to give some of her coins to Mila if that can make the money equal.

As Mila won’t share any of her coins with anyone, you are only provided with the total money with Mila and no details of her denominations.

You are required to find out whether they can distribute the money among themselves such that both of them have equal money.

Input:

The first line of the input consists of a single integer T denoting the number of test cases. Each of the test cases consists of two lines. The first line of each test case contains space separated two integers N and M, denoting the number of coins with Gila and the total amount present with Mila respectively. The next line contains space separated N integers denoting the value of each coin with Gila.

Output:

Print ‘1’ if they can distribute the money among themselves such that both of them have equal amount. Else, print ‘0’.

For each test case, print the output in a new line.

Constraints:

1 <= T <= 1000

1 <= N <= 50

0 <= M <= 5000

0 <= value of a coin <= 100

Example:

Input:

2

5 6

1 2 3 0 6

5 5

1 2 3 2 6

Output:

1

0

Explanation:

For the 1st test case:

Gila can give her Rs. 3 coin to Mila. Hence, both of them would have Rs. 9

For the 2nd test case:

There is no combination of coins Gila can give to her sister such that both of them would have the same amount.

#### ** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Sajal Agrawal
Author: sajalagrawal

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.