For this Question: A multi-set S of N integers, along with an integer K, is provided to Geetha. Given that Geetha can only add a maximum of K integers to the multi-set, she needs to determine the MEX, or minimal excluded non-negative integer, of the multi-set. Help her to determine the highest value of MEX she can get. Here are a few examples of finding the MEX of a multi-set. MEX of multi-set {0} is 1, {1} is 0, {0, 1, 3} is 2, {0, 1, 2, 3, 5, 6} is 4.The first line of the input 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 denoting the size of the multi-set and the maximum number of extra integers that you can add to the multi-set respectively. The second line contains N space-separated integers denoting the multi-set S: S<sub>1</sub>, S<sub>2</sub>,..... S<sub>N</sub>.

<b>Constraints</b>
1 &le; T &le; 10
1 &le; N &le; 10<sup>5</sup>
0 &le; K &le; 10<sup>5</sup>
0 &le; S<sub>i</sub> &le; 2x10<sup>5</sup>For each test case, output the answer in a single line.Sample Input :
4
3 0
1 0 2
3 1
1 0 2
4 3
2 5 4 9
2 0
3 4
Sample Output :
3
4
6
0
Explanation :
<ul><li>As K = 0, so we can't add any element to the multi-set. Elements of the set are {1, 0, 2}. The MEX value of this set is 3. </li><li>As K = 1, you are allowed to add at most 1 element to the multi-set. The multi-set is {1, 0, 2}. You can add element 3 to the multi-set, and it becomes {1, 0, 2, 3}. The MEX value of this multi-set is 4. There is no other way to have a higher value of MEX of the set by adding at most one element to the multi-set. </li></ul>, I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    int n,k;
	    cin>>n>>k;
	    int arr[n];
	    for(int i=0;i<n;i++){
	        cin>>arr[i];
	    }
	    sort(arr,arr+n);
	     int cnt=-1;
	    for(int i=0;i<n;i++){
	        if(cnt<arr[i]-1){
	            if(k>0){
	                while(cnt<arr[i]-1 && k>0){
	                 cnt++;
	                    k--;
	                }
	            }
	            else
	                break;
	        }
	        if(cnt ==arr[i]-1){
	        	  cnt++;
	        }
	    }
	    cout<<(cnt+k+1)<<endl;
	}
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?