#194. AC自动机?自动AC机!

AC自动机?自动AC机!

Description

传说中的自动AC机,搜索并读取答案文件作为输出 ( !!!不要尝试使用它 !!!)

The "automatic AC machine" works as follows: first it will figure out the solution the moment it gets the problem, and then start writing the program. Every second, the "automatic AC machine" may have the following two actions:

  1. Write kk lines of code;

  2. Feel unhappy, delete xx lines of code. If xx is greater than the length of the code currently written, delete all.

There is a strange OJ, and this OJ has a fixed length nn, once the "automatic AC machine" accumulates more than nn lines of code at the end of a second, it will submit his code automatically and get "Accepted", then clear the previous code and start solve the next question . CTR ran the "automatic AC machine" on this OJ for a whole day, and got a lot of log. He suddenly realized that he hadn't recorded the value of nn for this OJ. But fortunately, the OJ recorded the total number of Accepted solution is m. I hope you can calculate the minimum and maximum possible values of nn.

Input Format

The first line contains two integer r, m, denoting that the machine produced a total of r lines of log, passed m questions in total.

The second line contains r integers k1,k2,...,krk_1, k_2, ..., k_r. (0ki0 \leq k_i), denoting that wrote kik_i lines of code, ki<0k_i < 0 means deleting kik_i lines of code.


$r \leq 100000, m \leq 10000, -10^9 \leq k_i \leq 10^9$.

Output Format

Print two numbers aa and bb, representing the minimum and maximum possible values of n, respectively. If there is no such n, then output -1.

4 2
2
5
-3
9

3 7