#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n;
  int a[100010] = {};
  int ans = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ans1 = 0, ans2 = 0, ans3 = 0, ans4 = 0;
  for (int i = 0; i <= n - k; i++) {
    ans1 = 0;
    ans2 = 0;
    for (int j = 0; j < n; j++) {
      if (i <= j && j < i + k) {
        ans1 += a[j];
      } else if (a[j] > 0)
        ans2 += a[j];
    }
    ans1 += ans2;
    ans = max(ans, max(ans1, ans2));
  }
  cout << ans << endl;
}
