Problem1019--Find the missing number

1019: Find the missing number

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

Given m unique integers whose value is from 0 to n (include 0 and n), please find out the minimum missing integer.
( 1 <= m < n )

Input

The first line contains one integer T which is the number of cases, T <= 10
For each case:
the first line contains integers m and n    ( 1<= m < 1,000,000 ,   1 < n <= 100,000,000 )
the second line contains m integers 

Output

For each case, output one integer which is the minimum missing value

Sample Input Copy

3
10 20
19 7 0 1 2 10 12 14 3 4
8 13
1 2 10 9 7 0 4 5
9 20
1 9 20 19 2 5 3 11 19 

Sample Output Copy

5
3
0

Source/Category