Journey to "The World's Start"

Pick the cheapest travel card whose range lets you ride from stop 1 to stop n with transfer delays within t minutes.

Medium7Dynamic programmingBinary searchSliding windowNo attempts yetTime limit2sMemory limit256 MB

Problem

Jerry Prince is a fourth grade student, and he is going to New-Lodnon to see "The World's Start", the most popular amusement park there.

The airport he lands at is next to the first stop of the metro line. The line has nn stops and "The World's Start" is at the last one. The metro of New-Lodnon is fast, so you may assume that a ride from one stop to the next takes exactly one minute.

Jerry needs a travel card to use the metro. Every travel card has a range rr and a price pp. With a card of range rr Jerry may ride at most rr stops at once, so if he boards at stop ii he must get off at one of the stops from iri-r to i+ri+r. Getting off and boarding again at stop ii takes did_i minutes. Boarding at stop 1 and getting off at stop nn take no time.

Jerry is not rich but he has some spare time, so he decided to buy the cheapest travel card that lets him go from stop 1 to stop nn in at most tt minutes.

Input

The first line contains two integers nn and tt, the number of stops and the largest time he may spend (2n500002 \le n \le 50000, n1t109n-1 \le t \le 10^9).

The second line contains n1n-1 integers p1,p2,,pn1p_1, p_2, \dots, p_{n-1}, where prp_r is the price of the travel card of range rr (1pr1000001 \le p_r \le 100000).

The third line contains n2n-2 integers d2,d3,,dn1d_2, d_3, \dots, d_{n-1}, where did_i is the number of minutes needed to get off and board again at stop ii (1di1000001 \le d_i \le 100000). When n=2n = 2 this line is empty.

Output

Print one integer, the lowest price of a single travel card that lets Jerry go from stop 1 to stop nn in at most tt minutes.