Acowdemia I
Bessie the cow has enrolled in a computer science PhD program, driven by her love of computer science and also the allure of one day becoming "Dr. Bessie". Having worked for some time on her academic research, she has now published papers, and her -th paper has accumulated citations from other papers in the research literature.
Bessie has heard that an academic's success can be measured by their -index. The -index is the largest number such that the researcher has at least papers each with at least citations. For example, a researcher with papers and respective citation counts has an -index of , whereas if the citation counts were then the -index would be .
To up her -index, Bessie is planning to write a survey article citing several of her past papers. Due to page limits, she can include at most citations in this survey, and of course she can cite each of her papers at most once.
Help Bessie determine the maximum -index she may achieve after writing this survey.
Note that Bessie's research advisor should probably inform her at some point that writing a survey solely to increase one's index is ethically dubious; other academics are not recommended to follow Bessie's example here.
Input
The first line contains and .
The second line contains integers .
Output
The maximum -index Bessie may achieve after writing the survey.
Examples
Note
Example 1. Bessie cannot cite any of her past papers. As mentioned above, the -index for is .
Example 2. If Bessie cites her third paper, then the citation counts become . As mentioned above, the -index for these counts is .