Chocolate Distribution
medium
1. Given an array A[] of positive integers of size N, where each value represents the number of chocolates in a packet. Each packet can have a variable number of chocolates. There are M students, the task is to distribute chocolate packets among M students such that : 2. Each student gets exactly one packet. 3. The difference between maximum number of chocolates given to a student and minimum number of chocolates given to a student is minimum.
Constraints
1 <= N <= 10^5 1 <= Ai <= 10^9 1 <= M <= N
Format
Input
Input is managed for you
Output
Output is managed for you
Example
Sample Input
8
3 4 1 9 56 7 9 12
5
Sample Output
6