Schoolboy from Kolomyia
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian. In case of any discrepancy, the Ukrainian version is authoritative.
Zenyk transferred to the 11th grade of one of the reputable schools in the city of Kolomyia. He studies \(n\) subjects and deserves a grade \(p_{i}\) in the \(i\)-th subject.
Since the certificate score (along with the ZNO results) is taken into account upon admission, Zenyk wants to be an honors student, meaning he wants to have strictly more than 9 points in each subject (on a 12-point scale). Zenyk does not study very well, but he has as many as \(x\) dollars. The teachers of his school will gladly raise his grade by 1 point for 1 dollar.
Zenyk wants to know the maximum number of subjects in which he can get an honors grade, spending no more than \(x\) dollars.
Input
The first line contains two integers \(n\) and \(x\) — the number of subjects and the number of dollars Zenyk has.
The next line contains \(n\) integers \(p_{i}\) — the grades in each subject.
Output
In a single line, print an integer — the maximum number of subjects in which Zenyk can have an honors grade.
Constraints
\(1 \le n \le 10^{6}\),
\(0 \le x \le 10^{6}\),
\(1 \le p_{i} \le 12\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 4 3 8 9 9 10 | 3 |
Notes
In the example, Zenyk initially has 3 dollars. He already has an honors grade in the fourth subject, and for two dollars he can boost his grades in the second and third subjects. Unfortunately, Zenyk does not have enough with one dollar to get an honors grade in the first subject as well.
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|