#P1496B. Max and Mex
Max and Mex
No submission language available for this problem.
Description
You are given a multiset initially consisting of distinct non-negative integers. A multiset is a set, that can contain some elements multiple times.
You will perform the following operation times:
- Add the element (rounded up) into , where and . If this number is already in the set, it is added again.
Here of a multiset denotes the maximum integer in the multiset, and of a multiset denotes the smallest non-negative integer that is not present in the multiset. For example:
- ;
- .
Your task is to calculate the number of distinct elements in after operations will be done.
The input consists of multiple test cases. The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers , (, ) — the initial size of the multiset and how many operations you need to perform.
The second line of each test case contains distinct integers () — the numbers in the initial multiset.
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, print the number of distinct elements in after operations will be done.
Input
The input consists of multiple test cases. The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers , (, ) — the initial size of the multiset and how many operations you need to perform.
The second line of each test case contains distinct integers () — the numbers in the initial multiset.
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, print the number of distinct elements in after operations will be done.
Samples
Note
In the first test case, , , , . So is added into , and becomes . The answer is .
In the second test case, , , , . So is added into , and becomes . The answer is .