#include <bits/stdc++.h>
using namespace std;
int n, k;
long long a[((int)(1e5 + 10))], sum = 0, ans = -((int)(1e9));
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > 0) sum += a[i];
  }
  for (int i = 0; i <= n - k; i++) {
    long long integer = 0, fu = 0;
    for (int j = i; j < i + k; j++) {
      if (a[j] > 0)
        integer += a[j];
      else
        fu += (0 - a[j]);
    }
    long long rec;
    if (integer >= fu)
      rec = sum - fu;
    else
      rec = sum - integer;
    ans = max(ans, rec);
  }
  cout << ans << endl;
  return 0;
}
