N,X=map(int,input().split()) A=list(map(int,input().split())) ans=0 tmp=0 i=-N j=-N while j<0 and i-jX: tmp-=A[j] j+=1 else: tmp+=A[i] i+=1 if ans