#include <bits/stdc++.h>
using namespace std;
#define int              long long int
#define double           long double


const int M = 1000000007;
const int N = 3e5+9;
const int INF = 2e9+1;
const int MAXN = 100000;
const int LINF = 2000000000000000001;

//_ ***************************** START Below *******************************



vector<int> a;

//* Count of Exactly k = (Atmost k ) - (Atmost k-1 )

int atmostK(int n, int k){
		
	int s = 0, e = 0;
	int l = 0;
	int ans = 0;	
	int sum = 0;
	
	
	while(e<n){
	    sum += a[e];
	    if(sum < k){
	        e++;
	    }
	    else if(sum==k){
	    	ans += (l-s);
	    	e++;
	    }
	    else{
	        while(s<=e && sum>k){
	            sum -= a[s];
	            s++;
	        }
	        if(sum==k) ans += l-s;
	        e++;
	    }
	}	
    return ans;
}

int consistency1(int n, int k){
		// Handle goal == 0 case 
	int res = 0;
	int i=0;
	
	while(i<n){
	    while(i<n && a[i] == 1) i++;
	    if(i==n) break;	
	    int j = i+1;
	    while(j<n && a[j] == 0) j++;
	    int ct = j-i;
	    res += (ct*(ct+1))/2;
	    i = j;
	}
	if(k == 0) return res;
	
	
	return atmostK(n, k) - atmostK(n, k-1);
	
}




//* Template 1


int consistency2(int n, int k){
	
	// Handle goal == 0 case 
	int res = 0;
	int i=0;
	
	while(i<n){
	    while(i<n && a[i] == 1) i++;
	    if(i==n) break;	
	    int j = i+1;
	    while(j<n && a[j] == 0) j++;
	    int ct = j-i;
	    res += (ct*(ct+1))/2;
	    i = j;
	}
	if(k == 0) return res;	
	
	
	
	int big = 0, small = 0;	
	int s = 0, e = 0;
	int l = 0;
	int ans = 0;	
	
	while(e<n){
	    big += a[e];
	    small += a[e];	
	    while(l<=e && small >= k){
	        small -= a[l];
	        l++;
	    }	
	    if(big < k){
	        e++;
	    }
	    else if(big==k){
	    	ans += (l-s);
	    	e++;
	    }
	    else{
	        while(s<=e && big>k){
	            big -= a[s];
	            s++;
	        }
	        if(big==k) ans += l-s;
	        e++;
	    }
	}	
	return ans;

}




//* Template 2

int consistency3(int n, int k){
	
	// Handle goal == 0 case 
	int res = 0;
	int i=0;
	
	while(i<n){
	    while(i<n && a[i] == 1) i++;
	    if(i==n) break;	
	    int j = i+1;
	    while(j<n && a[j] == 0) j++;
	    int ct = j-i;
	    res += (ct*(ct+1))/2;
	    i = j;
	}
	if(k == 0) return res;	
	
	
	int big = 0, small = 0;	
	int s = 0, e = 0;
	int l = 0;
	int ans = 0;	
	
	while(e<n){
	    big += a[e];
	    small += a[e];	
	    while(l<=e && small >= k){
	        small -= a[l];
	        l++;
	    }	
	    if(big < k){
	        e++;
	    }
	    else{
	        while(s<=e && big>k){
	            big -= a[s];
	            s++;
	        }
	        if(big==k) ans += l-s;
	        e++;
	    }
	}	
	return ans;
}









int practice(int n, int k){
	
	return 0;	
}




void solve() {

	int n, k;
	cin >> n >> k;
	a.resize(n);
	for(int i=0; i<n; i++) cin >> a[i];

	cout << consistency1(n, k) << " " << consistency2(n,k) <<  " " << consistency3(n,k) << endl;
	
	// cout << consistency1(n, k) << " -> " << practice(n, k) << endl;
	
}





int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}