Irahc inside Icy Caves
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Description
Irahc is an experienced explorer leading an expedition trapped in a vast icy cave system. The team has members (including Irahc). The caves form a straight line of connected chambers, each capable of sheltering a certain number of team members. Some chambers are so small that they cannot accommodate even a single person. Specifically, the -th chamber can house members.
The entire expedition team, including Irahc, must be assigned to these chambers. As the team leader, Irahc wants to minimize the distance to the farthest member from himself, measured by the number of caves between them along the line.
As Irahc's assistant, you need to determine the smallest possible maximum distance between Irahc and any other team member.
If it is impossible to house all members in the available caves, output .
Format
Input
The first line contains two integers , the number of chambers and the number of team members.
The second line contains integers , where is the capacity of the -th chamber.
Output
Only one integer: the smallest possible maximum distance between Irahc and any other team member. Or , if it is impossible to house all members.
Samples
2 3
1 1
-1
3 2
1 0 1
2