Project Planning

AtCoder
IDabc227_d
Time2000ms
Memory256MB
Difficulty
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. ## Constraints * $1 \leq K \leq N \leq 2 \times 10^5$ * $1 \leq A_i \leq 10^{12}$ * All values in input are integers. ## Input Input is given from Standard Input in the following format: $N$ $K$ $A_1$ $A_2$ $\ldots$ $A_N$ [samples]
Samples
Input #1
3 3
2 3 4
Output #1
2

There can be two projects, each composed of three employees from distinct departments.
Input #2
4 2
1 1 3 4
Output #2
4
Input #3
4 3
1 1 3 4
Output #3
2
API Response (JSON)
{
  "problem": {
    "name": "Project Planning",
    "description": {
      "content": "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 project",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc227_d"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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.\nThe company is planning cross-departmental project...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments