cswork / OA打开练习工作台

IBMOA #19

Equalize Team Size

估计中等可在线判题

考点(AI 标注)哈希计数原地数组

Choose at most k teams and reduce their sizes; sizes cannot be increased, and no new team can be split off. Find the maximum number of teams that end up with the same size.

输入格式

The first line contains n k, and the second line contains the team sizes. 1≤n≤200000, sizes are 1..10^9, 0≤k≤10^9.

输出格式

Output one integer, the answer.

样例 1

输入:

5 2
1 2 2 3 4

输出:

4

样例 2

输入:

3 0
3 3 1

输出:

2

样例 3

输入:

3 99
1 2 3

输出:

3

样例说明

The examples give 4, 2 and 3 respectively.