← 返回 bytedance 的题目列表Maximum Candies Allocated to K Children
类型:online_judge
Problem: Maximum Candies Allocated to K Children
You are given an integer array candies, where candies[i] is the number of candies in the i-th pile. You are also given an integer k, the number of children.
You may split any pile into several smaller piles, but you cannot merge candies from different piles. Each child can receive at most one pile, and every child must receive the same number of candies.
Return the maximum number of candies each child can get. If it is impossible for every child to get at least one candy, return 0.
Input Format
The first line contains two integers n and k, the number of piles and children.
The second line contains n integers, the array candies.
Output Format
Print one integer: the maximum number of candies each child can get.
Constraints
1 <= n <= 10^5
1 <= candies[i] <= 10^7
1 <= k <= 10^12
Example
Input:
3 3
5 8 6
Output:
5
Example
Input
3 3
5 8 6
Output
5