#H2025I. Irahc inside Icy Caves
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
相关
在下列比赛中: