Олимпиадный тренинг

Задача 44939. MEX(A)


Let's define the function mex as follows: mex(A) — is the minimum positive integer that is not in the set A

For example, mex of set {1, 2, 3, 5, 100}  is 4, and mex of set {2, 3, 4, 5}  is 1 .

You have a set of numbers A, consisting of n positive integers, and a positive number k. Then you performed the following operation k times: added to the set A one more number equal to mex(A), thereby increasing the size each time set A by one.

Given a set A and a number k determine the last number that was added to the set.

Input
The first line contains two integers n and k (1<=n<=100000, 1<=k<=109) &mdash ; the number of numbers in the set and the number of addition operations.
The second line contains n distinct integers a1a2, ..., an (1<=ai<=100000) — elements of set A.

Imprint
Print a single integer — the last number that was added to the set.

Note
In the first example, the mex of the set {1, 2, 4, 5}  is equal to 3, after adding mex to the set, it will become equal to {1, 2, 3, 4, 5}.

 
Examples
# Input Output
1
4 1
4 2 1 5
3
2
7 10
1 3 20 2 7 45 5
15