10256: CF EDU - Binary Search - Step 2 - G. Student Councils
[Creator : ]
Description
Given the number $k$. Each student council must consist of $k$ students. Important rule: each council should be composed of students from different groups. That is, no two students from the same group can be in the same council.
Of course, each student should be in no more than one council (it is possible that some students are not included in any).
An array $a[1..n]$ is given, where $a[i]$ is the number of students in the $i$-th group. What is the maximum number of councils can be formed?
Input
The first line contains integer $k\ (2≤k≤20)$.
The second line contains integer $n\ (k≤n≤50)$.
Next lines contain elements $a[1],a[2],…,a[n]\ (1≤a[i]≤10^9)$.
Output
Print the required value.
Sample 1 Input
3
5
4
4
4
4
4
Sample 1 Output
6
Sample 2 Input
4
6
1
2
3
4
5
6
Sample 2 Output
5