You are given an array $$$a$$$ of $$$n$$$ integers and a positive integer $$$k$$$.
You want to split some of the elements of $$$a$$$ into groups $$$S_1, S_2, \ldots, S_m$$$ ($$$m \ge 0$$$) such that:
Find the maximum possible value of $$$\operatorname{mex}(\{\max(S_1), \max(S_2), \ldots, \max(S_m)\})$$$ over all valid ways to form the groups, where $$$\operatorname{mex}(c)$$$ denotes the smallest non-negative integer that does not appear in the collection $$$c$$$. If $$$m = 0$$$, the collection is empty and $$$\operatorname{mex}(\{\}) = 0$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 500$$$). The description of the test cases follows.
The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$) — the length of the array $$$a$$$ and the minimum allowed size of each group.
The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le n$$$) — the elements of the array $$$a$$$.
For each test case, output a single integer — the maximum possible value of $$$\operatorname{mex}(\{\max(S_1), \max(S_2), \ldots, \max(S_m)\})$$$ over all valid ways to form the groups.
63 10 2 14 21 2 3 45 20 1 0 1 05 40 0 1 0 05 14 0 0 0 26 20 0 2 1 0 0
302113
In the first test case, one optimal way is to form the groups $$$\{0\}$$$, $$$\{1\}$$$, $$$\{2\}$$$, which gives $$$\operatorname{mex}(\{0, 1, 2\}) = 3$$$.
In the second test case, one optimal way is to form the single group $$$\{1, 2, 3, 4\}$$$, which gives $$$\operatorname{mex}(\{4\}) = 0$$$.
In the third test case, one optimal way is to form the groups $$$\{0, 0\}$$$ and $$$\{1, 1\}$$$, which gives $$$\operatorname{mex}(\{0, 1\}) = 2$$$.