#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define re return
#define all(a) a.begin(),a.end()
#define int long long
#define Type int
#define rept(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,a) rept(i,0,a)
using namespace std;
void fail(string s){ cout<<s;exit(0); }
void fail(int s){ cout<<s;exit(0); }
void run(){
	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	rep(i,n)cin>>v[i];
	sort(all(v));
	int cur=0;
	rep(i,n){
		cur+=v[i];
		if (cur==k){
			if (i==n-1){
				cout<<"NO\n";
				re;
			}
			swap(v[i],v[i+1]);
			break;
		}
	}
	cout<<"YES\n";
	rep(i,n)cout<<v[i]<<' ';
	cout<<'\n';
}
signed main()
{
	int tc=1;
	cin>>tc;
	while (tc--)
		run();
	re 0;
}
