#include<bits/stdc++.h>
using namespace std;

int main()
{
 ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	long long int t;
	cin >> t;
	while (t--)
	{
	    long long int n,k;
	    cin>>n>>k;
	    long long int arr[n];
	    for(int i=0;i<n;i++)
	    cin>>arr[i];
	    sort(arr,arr+n);
	   int i=0,j=n-1;
	   long long int sum=0;
	   vector<long long int>a;
	   int key=1;
	   while(i<=j)
	   {
	       if(sum+arr[i]!=k)
	       {
	       sum+=arr[i];
	       a.push_back(arr[i]);
	       i++;
	       }
	       else{
	           sum+=arr[j];
	            a.push_back(arr[j]);
	           j--;
	       }
	       if(sum==k)
	       {
	           key=0;
	           break;
	       }
	       
	   }
	   if(key==0)
	   cout<<"NO"<<endl;
	   else{ cout<<"YES"<<endl;
	   for(i=0;i<n;i++)
	   cout<<a[i]<<" ";
	   cout<<endl;
	   }
	   
    }
 
}
 