N,X,*A=map(int,open(0).read().split());s=abs(X)//X;a=L=0 for i in A[::s]: if(I:=s*i)>0:a+=max(0,min(s*X,I)-max(L,I-30));L=I print(a)