Eavesdropper Evasion

아직 제출이 없습니다시간 제한3.5초메모리 제한1024 MB

문제

Alice wants to send nn messages to Bob over a communication channel. The iith message takes t_it\_i time steps to send.  At each integer time step, Alice can start sending any number of her messages.  Once started, a message must be transmitted in its entirety (it cannot be paused and resumed later).  Any number of messages can be sent in parallel over the channel without affecting the transmission time of individual messages.

An attacker has the capability to disable the security protocols of the channel for an interval of xx continuous time steps, but only once (i.e., after doing this, they cannot wait a while and then disable it for another xx time steps).  While the security is disabled, the attacker is able to listen in, and any message that is sent in its entirety during those xx time steps is considered exposed.

What is the minimum time needed for Alice to send all nn messages to Bob so that at most two messages are exposed, no matter when the attacker chooses to disable the security?

Figure E.1: Left: Illustration of a solution to Sample Input 1.  Right: sending the message of length 44 a time step earlier would not be a solution, because the three messages of length 66, 44, and 33 would then be exposed to an eavesdropper listening in from time step 55 to time step 1515.

입력

The first line of input contains the two integers nn and xx (1n20,0001 \leq n \leq 20\\,000, 1x10,0001 \leq x \leq 10\\,000), the number of messages Alice wants to send and the number of time steps someone may listen in.  This is followed by a line containing nn integers t_1,,t_nt\_1, \ldots, t\_n (1t_i10,0001 \leq t\_i \leq 10\\,000), the number of time steps it takes to transmit each message.

출력

Output the minimum number of time steps to complete transmission of all nn messages so that at most two of them can be exposed.