Sled

No attempts yetTime limit1sMemory limit1024 MB

Statement

A dwarf loves sledding down a hill along a toboggan track. At the moment he sets off (the very start), the sled's speed is 0. The track is divided into NN segments, and for each segment you are told how the sled's speed changes after passing it: it increases or decreases by aia_i m/s.

The dwarf's sled is smart — it measures its speed and slows itself down when necessary. If, at the junction between two segments, the sled's speed exceeds SS m/s, the sled brakes and its speed decreases by 1 m/s. Braking happens only at junctions between segments, never at the very end of the track.

Determine the speed at which the sled reaches the bottom of the hill (after passing the last segment).

Input

The first line contains the number of segments NN and the threshold speed SS. Whenever the speed exceeds SS, the sled is braked.

Each of the next NN lines contains a single integer aia_i — how much the sled's speed changes after passing the corresponding segment.

Output

Output the sled's speed at the end of the track.

The input is always such that the sled is guaranteed to finish the whole track, i.e. the speed never drops to 0 (except possibly at the very end of the track).

Constraints

  • 2N,S10002 \le N, S \le 1000
  • 10ai10-10 \le a_i \le 10