import sys
input = sys.stdin.readline

def main():
    N,K = map(int,input().split())
    a = list(map(int,input().split()))
    def point(x):
        use = a[:x]+a[x+K:]
        borf = a[x:x+K]
        score = 0
        for num in use:
            if num > 0:
                score += num
        if sum(borf) > 0:
            score += sum(borf)
        return(score)
        
    ans = 0
    for i in range(N-K+1):
        ans = max(ans,point(i))
        
    print(ans)
    
if __name__ == "__main__":
    main()
