Let's say 'N' = 2, 'M' = 5, 'A' = {2, 3}
At time = 0, there will be 0 dishes prepared.
At time = 2, chef 0 will complete a dish so there will be 1 dish in total.
At time = 3, chef 1 will complete a dish so there will be 2 dishes in total.
At time = 4, chef 0 will complete a dish so there will be 3 dishes in total.
At time = 6, chef 0 and 1 will both complete a dish so there will be 5 dishes in total.
Hence, 6 minutes are required to complete 5 dishes.
The first line of input contains a single integer 'T', which denotes the number of test cases.
Then 'T' test cases follow. For each test case:
The first line contains two space-separated integers 'N' and 'M', denoting the number of chefs and the number of dishes to make, respectively.
The second line contains 'N' space-separated integers, representing the values of the array 'A'.
For each test case, you must return the minimum time required to make at least 'M' dishes in total
You don't need to print anything; it has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 10^5
1 <= M <= 10^9
1 <= A[i] <= 10^5
The sum of 'N' over all test cases does not exceed 10^5.
Time Limit: 1 sec
Element Count in Ranges
First Digit One
Minimize Maximum Adjacent Distance
Sorted Doubly Linked List to Balanced BST
Minimized Maximum of Products Distributed to Any Store