## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] K-MEX CodeChef Solution | CodeChef Solution

You are given an array $A$ containing $N$ integers. Find if it is possible to choose exactly $M$ elements from the array such that the MEX of the chosen elements is exactly $K$.

Recall that the MEX of an array is the smallest non-negative integer that does not belong to the array. For example, the MEX of $\left[2,2,1\right]$ is $0$ because $0$ does not belong to the array, the MEX of $\left[3,1,0,1\right]$ is $2$ because $0$ and $1$ belong to the array, but $2$ does not.

### Input Format

• The first line contains an integer $T$, denoting the number of test cases. The $T$ test cases then follow:
Solution Click Below:-  👉
👇👇👇👇👇

• The first line of each test case contains an integer $N,M,K$, denoting the length of the array, the number of elements to be chosen, and the required MEX respectively.
• The second line of each test case contains $N$ space-separated integers ${A}_{1},{A}_{2},\dots ,{A}_{N}$, denoting

•  the elements of the array.

### Output Format

For each test case, print YES if it is possible to choose $M$ elements from the array $A$ so that the MEX of the chosen elements is exactly $K$ and NO otherwise.

You may print each character of the string in uppercase or lowercase (for example, the strings yEsyesYes and YES will all be treated as identical).

### Constraints

• $1\le T\le 100$
• $1\le N\le 100$
• $1\le M\le N$