Submit solution

Points: 0.00
Time limit: 1.0s
Memory limit: 1G
Input: stdin
Output: stdout

Author:
Problem type
Allowed languages
C, C++, Go, Java, Kotlin, Pascal, PyPy, Python, Rust, Scratch

After the Battle of Yavin, the Rebel Alliance established the Echo Base as a temporary headquarters in Hoth. The harsh conditions on this frigid planet force the Rebel army to heavily rely on the Heating System for the hope of surviving and then continuing to fight against the Galactic Empire. The Heating System is not only important in keeping the soldiers warm, but also for maintaining various droids and weapons.

The Heating System requires at least ~x~ units of energy to be effective. The Rebels prepared ~n~ fusion generators, where the ~i~-th generator can release ~a_i~ units of energy. If the Rebels use multiple generators, the amount of released power can be calculated as the sum of released power from each of the used generators.

A generator is called faultable if, when that generator is faulty, the remaining ~n-1~ generators would still release at least ~x~ units of power for the Heating System.

Speculated that harsh weather in Hoth might defect one generator, Luke asked R2-D2 to count the number of faultable generators. R2-D2 calculated and returned the value ~k~.

Unfortunately, after taking the ~k~ from R2-D2, Luke forgot the value ~x~. He wants to check if there exists a non-negative integer ~x~ such that there are exactly ~k~ faultable generators among ~n~ prepared ones.

Input

Each test contains multiple test cases. The first line contains the number of test cases ~t~ (~1 \leq t \leq 100~). The description of the test cases is as follows.

The first line of each test case contains two integers ~n, k~ (~2 \leq n \leq 100, 0 \leq k \leq n~), the number of generators and the number of faultable generators calculated by R2-D2, respectively.

The second line of each test case contains ~n~ integers ~a_1, a_2, \dots, a_n~ (~1 \leq a_i \leq 1000~), the amount of released power by the generators.

Output

For each test case, if there exists a non-negative integer ~x~ such that there are exactly ~k~ faultable generators, print YES; otherwise, print NO.

Sample Input 1

6
5 0
1 3 5 3 1
5 1
1 3 5 3 1
5 2
1 3 5 3 1
5 3
1 3 5 3 1
5 4
1 3 5 3 1
5 5
1 3 5 3 1

Sample Output 1

YES
NO
YES
NO
YES
YES

Comments

Please read the guidelines before commenting.