Bessie is a PhD student in computer science. She has published papers, and her -th paper has been cited c_i times.
Bessie has heard that academic achievements are measured by the -index. The -index is the largest number such that the researcher has at least papers, each of which has been cited at least times. For example, a researcher with four papers and citation counts (1, 100, 2, 3) has an -index equal to , while a researcher with citation counts (1, 100, 3, 3) has an -index equal to .
To increase her -index, Bessie plans to write a survey paper in which she will cite some of her previous works. Due to length constraints, she can include at most citations, and of course, she can cite each of her papers at most once.
Help Bessie determine the maximum -index she can achieve by writing such a survey paper.
Note that her advisor should have warned Bessie that writing a paper solely to increase her -index raises ethical concerns.
The first line contains integers n~(1 \le n \le 10^5) and l~(0 \le l \le 10^5).
The second line contains integers c_1, \dots, c_n~(0 \le c_i \le 10^5).
Print the maximum -index that Bessie can obtain by writing a survey paper.
Example 1
Example 2
Example 1. Bessie cannot cite her papers. Her -index for (1, 100, 2, 3) is .
Example 2. If Bessie cites the third paper, the citation counts become (1, 100, 3, 3). In this case, h = 3.