Allocate Minimum Number Of Pages

easy
1.You are given N number of books.
 2.Every ith book has Pi number of pages. 
 3.You have to allocate books to M number of students.
 4.There can be many ways or permutations to do so.
 5.In each permutation one of the M students will be allocated the maximum number of pages.
 6.Out of all these permutations.
 7.Your task is to find that particular permutation in which the maximum number of pages allocated to a student is minimum of those in all the other permutations.
 8.You have to complete the function minPagesAllocation() that should return the minimum pages required. 
 9.Each book will be allocated to exactly one student. Each student has to be allocated atleast one book.

Input Format

1.First line contains a single positive integer N denoting the number of books. 2.The second line contains N space separated positive integers denoting the pages of each book. 3.And the third line contains another integer M, denoting the number of students.

Output Format

Return minimum number of pages each student has to read.

Constraints

1 <= N <= 106
 1 <= A [ i ] <= 106
 1 <= M <= 106

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
4
12 34 67 90
2
Output
113
Previous
Split Array Largest Sum
Next
Counting Elements In Two Arrays

Related Questions