#include<bits/stdc++.h>
using namespace std;
const int M=2e5+5;
typedef long long ll;
ll a[M];
ll sum[M];
int main(){
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	int t;
	cin>>t;
	while(t--){
		memset(a,0,sizeof(a));
		memset(sum,0,sizeof(sum));
		int n,k;
		cin>>n>>k;
		for(int i=1;i<=n;i++){
			cin>>a[i];
			sum[i]=sum[i-1]+a[i];
		}
        ll con=-1e12; ll ans=-1e12;
		for(int i=k;i+k<=n;i++){
            con=max(con,sum[i]-sum[i-k]);
            ans=max(ans,con+sum[i+k]-sum[i]);
		}
		cout<<ans<<endl;
	}
    return 0;
}