#K78242. Make Even Occurrences

    ID: 35043 Type: Default 1000ms 256MiB

Make Even Occurrences

Make Even Occurrences

You are given an array of M integers and a number P which represents the maximum number of operations allowed. In one operation, you can add one instance of any integer to the array.

Your task is to determine whether it is possible to make the occurrence count of every distinct integer in the array even by performing at most P operations. Formally, let \(f(x)\) be the frequency of integer \(x\) in the array and let \(odd_count\) be the number of integers for which \(f(x)\) is odd. The answer is "YES" if \(odd_count \leq P\), and "NO" otherwise.

Note: The input is provided through standard input and the output should be written to standard output.

inputFormat

The first line contains an integer Q representing the number of test cases.

Each test case consists of two lines:

  • The first line contains two space-separated integers: M (the number of elements in the array) and P (the maximum number of operations allowed).
  • The second line contains M space-separated integers representing the array.

outputFormat

For each test case, output a single line containing "YES" if it is possible to make every distinct integer occur an even number of times using at most P operations, otherwise output "NO".

## sample
2
5 3
1 2 2 3 3
4 1
1 1 2 3
YES

NO

</p>