#include <bits/stdc++.h>
int main(void) {
  int loop1, loop2;
  int how_data;
  int can;
  scanf("%d %d\n", &how_data, &can);
  long long int data[how_data];
  for (loop1 = 0; loop1 < how_data; loop1++) {
    scanf("%lld", &data[loop1]);
  }
  long long int syakutori = 0;
  long long int max_syakutori = -1000000000000000;
  for (loop1 = 0; loop1 < can; loop1++) {
    syakutori += data[loop1];
  }
  max_syakutori = syakutori;
  for (loop1 = 1; loop1 < how_data - can + 1; loop1++) {
    syakutori -= data[loop1 - 1];
    syakutori += data[loop1 + can - 1];
    if (max_syakutori < syakutori) {
      max_syakutori = syakutori;
    }
  }
  printf("%lld\n", max_syakutori);
  return 0;
}
