You are given an array $$A$$ that consists of $$N$$ positive integers. A subset of the array $$A$$ is good when the sum of the elements of the subset is $$K$$ or greater.
An element of the array is unnecessary if for any good subset of the array containing $$i$$ element, the set that can be obtained by eliminating $$i$$ from the subset is also good.
Find the number of the unnecessary elements present in array $$A$$.
Input format
- The first line contains an integer $$T$$ denoting the number of test cases.
- The first line of each test case contains two space-separated integers $$N$$ and $$K$$.
- The second line of each test case contains $$N$$ space-separated integers denoting array $$A$$.
Output format
For each test case, print the total number of unneccessary elements present in the array in a new line.
Constraints
3 3 6 1 4 3 5 400 3 1 4 1 5 6 20 10 4 3 10 25 2
1 5 3
For the first testcase, there are two good sets: {$$2,3$$} and {$$1,2,3$$}.
Element $$1$$ is only contained in {$$1,2,3$$}, and this set without element $$1$$, {$$2,3$$}, is also good. Thus, element $$1$$ is unnecessary.
For element $$2$$, a good set {$$2,3$$} without element $$2$$, {$$3$$}, is not good. Thus, element $$2$$ is NOT unnecessary.
Neither is element $$3$$ for a similar reason, hence the answer is $$1$$.
For the second testcase, there is no good set. Therefore, all the elements are unnecessary.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor