#include <bits/stdc++.h>
using namespace std;
long long n, k, a[1000005];
int main(){
cin >> n >> k;
for(int i = 1; i <= n; i++) cin >> a[i];
long long res = 0, sum = 0;
//Cửa sổ đầu tiên
for(int i = 1; i <= k; i++){
sum = sum + a[i];
}
//Kết quả cho cửa sổ đầu tiên
res = max(res, sum);
//Các cửa sổ tiếp theo
int i = 1;
for(int j = k + 1; j <= n; j++){
sum = sum + a[j];
sum = sum - a[i];
res = max(res, sum);
i++;
}
cout << res;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpsb25nIGxvbmcgbiwgaywgYVsxMDAwMDA1XTsKaW50IG1haW4oKXsKICAgIGNpbiA+PiBuID4+IGs7CiAgICBmb3IoaW50IGkgPSAxOyBpIDw9IG47IGkrKykgY2luID4+IGFbaV07CiAgICBsb25nIGxvbmcgcmVzID0gMCwgc3VtID0gMDsKCiAgICAvL0Phu61hIHPhu5UgxJHhuqd1IHRpw6puCiAgICBmb3IoaW50IGkgPSAxOyBpIDw9IGs7IGkrKyl7CiAgICAgICAgc3VtID0gc3VtICsgYVtpXTsKICAgIH0KCiAgICAvL0vhur90IHF14bqjIGNobyBj4butYSBz4buVIMSR4bqndSB0acOqbgogICAgcmVzID0gbWF4KHJlcywgc3VtKTsKCiAgICAvL0PDoWMgY+G7rWEgc+G7lSB0aeG6v3AgdGhlbwogICAgaW50IGkgPSAxOwogICAgZm9yKGludCBqID0gayArIDE7IGogPD0gbjsgaisrKXsKICAgICAgICBzdW0gPSBzdW0gKyBhW2pdOwogICAgICAgIHN1bSA9IHN1bSAtIGFbaV07CiAgICAgICAgcmVzID0gbWF4KHJlcywgc3VtKTsKICAgICAgICBpKys7CiAgICB9CiAgICAKICAgIGNvdXQgPDwgcmVzOwogICAgcmV0dXJuIDA7Cn0=