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.
1 <= N <= 10^5 1 <= Ai <= 10^9 1 <= M <= N
Input is managed for you
Output is managed for you
8 3 4 1 9 56 7 9 12 5