(N,X),A=$<.map{_1.split.map &:to_i} t=-9e9 p A.map{X<0?-_1:_1}.sort.sum{[-[0,t,_1-30].max+[X.abs,t=_1].min,0].max}