class Cumsum: def __init__(self,lst,mod=0): self.N=len(lst) self.mod=mod self.cumsum=[0]*(self.N+1) self.cumsum[0]=0 for i in range(1,self.N+1): self.cumsum[i]=self.cumsum[i-1]+lst[i-1] if self.mod: self.cumsum[i]%=self.mod def __getitem__(self,i): if type(i)==int: if 0<=i1: mid=(ok+ng)//2 if is_ok(mid): ok=mid else: ng=mid return ok N,K=map(int,input().split()) A=Cumsum(list(map(int,input().split()))) inf=1<<60 ans=inf for l in range(N-K+1): r=l+K c0=l c1=N-r m=l+r-N//2 for i in (m-2,m-1,m,m+1,m+2,l,r-1): def f(l,r): return A[l:r]-(r-l)*A[i] if 0<=i