tom-jerry-1

Tom has an array A of ‘n’ integers (positive and negative both). Now Tom wants to play with this
array. Tom selects ‘k’ numbers out of these ‘n’ and gives it to Jerry .

Now Tom gives a task to Jerry and the task is : Select more numbers from the array other than the given ‘k’ numbers such that the sum of all the numbers (newly selected and the previously given 'k' numbers) is zero.If the sum of 'k' numbers is positive then select only negative numbers and vice-versa.

The twist is that as the numbers might repeat in the parent array, you cannot use any number to get a sum zero more than once. 

Constraints:
1 ≤ T ≤100

1 ≤ n ≤ 10000

1 ≤k ≤ n

-100 ≤ A[i] ≤ 100

SAMPLE INPUT
2
10 3
8 -1 4 -8 7 -4 -3 6 11 -2
8 7 -4
5 2
4 7 -1 2 -7
4 7

SAMPLE OUTPUT
YES
NO

Explanation

First line is ‘T’ the number of test cases.

First line of each test case contains two numbers ‘n’ and ‘k’ respectively.

The second line contains ‘n’ numbers the elements of the array.

The third line contains ‘k’ numbers selected from the array.

Print “YES” if you can make the sum zero else print “NO”.

A quick Example and Explanation:

1

7 3

4 7 -2 -1 -1 2 -7 

4 -2 7

Output: NO . Since you have to use the set {-7, -1, -1} for a zero-sum, but usage of -1 twice is not allowed.

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions: