#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = 2e5 + 10;
int t,n,k,a[maxn];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin >> t;
while(t--){
cin >> n >> k;
for(int i = 1; i <= n; i++){
cin >> a[i];
a[i] += a[i - 1];
}
int pre = -2e10;
int cnt = -2e10;
for(int i = k; i + k <= n; i++){
pre = max(pre,a[i] - a[i - k]);
cnt = max(cnt,pre + a[i + k] - a[i]);
}
cout << cnt << endl;
}
return 0;
}