Buns eating
Kratos and Atreus decided to eat buns. To diversify the process, Kratos prepared buns and offered to arrange a speed-eating competition.
Both Kratos and Atreus will eat buns. It all ended as fast as it started. Freya secretly watched this contest and noticed several features:
Both contestants ate exactly buns.
In one action, Kratos or Atreus ate either one or two buns.
Each time one of them took an action, he recorded how many buns he ate.
After Kratos and Atreus left, Freya found their “protocol." Unfortunately, for each action, it is recorded how many buns were eaten, but it was not recorded who exactly ate them.
Freya remembers that at some point in the competition, Kratos looked like an unconditional leader, since he ate buns much more than Atreus. She asks you, according to this protocol, to determine what the largest gap Kratos could have during the competition.
Input
The first line contains two integers and — the number of entries in the protocol and the number of buns eaten by each of the participants.
The second line contains integers — the protocol data. It is guaranteed that the protocol is correct: you can divide into two sets so that the sum of the numbers in both sets is .
Output
Print a single integer — the largest advantage of Kratos during the match.