P24228 [AtCoder] Project Planning
提高-
题目描述

Problem Statement

KEYENCE has N departments, where A_i employees belong to the $i-th department (1 \leq i \leq N).$ No employee belongs to multiple departments.
The company is planning cross-departmental projects. Each project will be composed of exactly K employees chosen from K distinct departments.
At most how many projects can be made? No employee can participate in multiple projects.

Input

Input is given from Standard Input in the following format:
N K
$A_1 A_2 \ldots A_N$

Output

Print the maximum possible number of projects.

Constraints

  • $1 \leq K \leq N \leq 2 \times 10^5$
  • $1 \leq A_i \leq 10^{12}$
  • All values in input are integers.

Sample Input 1

3 3
2 3 4

Sample Output 1

2

There can be two projects, each composed of three employees from distinct departments.

Sample Input 2

4 2
1 1 3 4

Sample Output 2

4

Sample Input 3

4 3
1 1 3 4

Sample Output 3

2

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 3 2 3 4
样例输出
2