Mimi is playing more Enur Yrotcaf 4, when she realizes that her damage output is…subpar.
Being a meticulous player, she has tracked her damage output over the last seconds, and decides to take a contiguous subsection where her damage output is at least .
Wanting to show off to her friends, she wants this interval to be as short as possible. Can you help her find the length of the smallest interval where she deals at least damage?
For all subtasks:
Mimi will deal at least damage, and at most units of damage per second.
Subtask 1 [10%]
Subtask 2 [30%]
Subtask 3 [60%]
The first line of input will contain two space-separated integers, and .
The next line of input will contain space-separated integers, , where is how much damage Mimi deals at time .
The smallest integer such that there is a contiguous subarray of length where Mimi deals at least total damage, or
-1 if no such subarray exists.
Sample Input 1
5 6 1 3 2 5 0
Sample Output 1
Sample Input 2
5 30 1 2 3 4 5
Sample Output 2