#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  long a[100010], sum = 0;
  cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
    if (a[i] > 0) sum += a[i];
  }
  long ans = 0;
  for (int i = 0; i + K < N; ++i) {
    long bl = sum, wh = sum;
    for (int p = 0; p < K; ++p) {
      if (a[i + p] > 0)
        wh -= a[i + p];
      else
        bl += a[i + p];
    }
    ans = max(ans, max(bl, wh));
  }
  cout << ans << endl;
  return 0;
}
