Revachol, Jamrock, Precinct 41. The body still hangs behind the Whirling-in-Rags, and the RCM demands paperwork.
Your evidence ledger has $$$N$$$ entries, each stamped with a non-negative case number. Logic points out the obvious: the Coalition's clerks do not read your report — they only measure its Completeness Index, defined as the smallest non-negative integer that does not appear among the case numbers in the ledger. The higher the index, the more thorough you appear.
Inland Empire whispers that ink is negotiable. You may overwrite the case number of at most $$$K$$$ entries, replacing each with any non-negative integer you like. You cannot add entries and you cannot tear any out — Kim would notice.
Determine the maximum Completeness Index your ledger can attain.
The first line contains two integers $$$N$$$ and $$$K$$$ $$$(1 \le N \le 2 \cdot 10^5$$$, $$$0 \le K \le N)$$$ — the number of entries in the ledger and the number of entries you may overwrite.
The second line contains $$$N$$$ integers $$$a_1, a_2, \ldots, a_N$$$ $$$(0 \le a_i \le 10^9)$$$, where $$$a_i$$$ is the case number stamped on the $$$i$$$-th entry.
Print a single integer: the maximum Completeness Index achievable by overwriting at most $$$K$$$ entries.
6 20 2 3 7 1 9
6
4 15 5 5 5
1
The Completeness Index of a collection of non-negative integers is the smallest non-negative integer absent from it. For example, the index of $$$\{0, 1, 3\}$$$ is $$$2$$$, the index of $$$\{1, 2\}$$$ is $$$0$$$, and the index of $$$\{\}$$$ is $$$0$$$.
| Название |
|---|


