A team of Champions in sports programming participated in important competitions that lasted $$$K $$$ minutes. They were held according to the standard rules, but the guys learned that the scoring system did not always correctly calculate the penalty time. Namely, when the penalty time became more than $$$23$$$ hours and $$$59$$$ minutes, $$$24$$$ hours were subtracted from it.
Having received a set of $$$N$$$ problems, the champions could instantly determine for each of them the time $$$t_i$$$ (in minutes) that they would need to solve and debug the program for solving the $$$i$$$-th problem. As a matter of fact, the Champions had always submitted all the tasks on the first attempt. As true professionals, the guys did not waste a single minute during the competition. As soon as they passed one task, they immediately began to solve the next one. Knowing about the error in the calculation of penalty minutes, they wanted to determine the best result that they could show if they passed the necessary tasks in the right order. Create a program that will help them do this.
The first line contains two positive integers separated by a space — the duration of the competition $$$ K$$$ in minutes ($$$1 \leq K \leq 1000$$$) and the number of tasks $$$N$$$ ($$$1 \leq N \leq 10$$$).
In the second line, separated by a space, $$$N$$$ natural numbers $$$t_i$$$ are written, $$$(1 \le t_i \le 1000)$$$ — the solution time in minutes of the $$$i$$$-th problem.
Output two integers, that determine the best possible result of the team — the number of tasks $$$M$$$, that the team will have time to pass during the competition and the total penalty time $$$T$$$, which is calculated in the erroneous way described above.
75 5 5 25 15 10 20
5 175
480 8 3 150 160 2 165 200 2 300
5 0
In the first example, it is advantageous for the team to adhere to standard tactics and solve problems in the ascending order of their solution duration, because they will not be able to use an error (if they have it) in the time calculation.
In the second example, the team will have time to solve only $$$5$$$ out of $$$8$$$ tasks. If they pass the tasks in the order of $$$5, 2, 1, 7, 4$$$, then the total penalty time will be $$$165 + (165 + 150) + (165 + 150 + 3) + (165 + 150 + 3 + 2) + (165 + 150 + 3 + 2 + 2) = 165 + 315 + 318 + 320 + 322 = 1440$$$ minutes, which will be calculated in 0 minutes.
| Name |
|---|


