#CCBCHBAHAI0000157. Chọn đội (Choosing Teams)
Chọn đội (Choosing Teams)
Choosing Teams
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are students. Student has already participated in the world championship times, and no student may participate more than times.
Each new team must contain exactly distinct students, and no student may belong to two teams. Every chosen team must be able to participate with the same members at least more times.
Thus student is eligible exactly when
Compute the maximum number of teams that can be formed.
Input
- The first line contains integers and .
- The second line contains integers .
Output
Print one integer: the maximum number of teams.
Subtasks
Subtask 1 (100 points): ; ; .
Examples
Input
5 2
0 4 5 1 0
Output
1
Explanation
The condition is , or . Exactly three students are eligible, so exactly one team can be formed.