#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
typedef long long ll;
const double pi = acos(-1.0);
const int mod = (1 ? 1000000007 : 998244353);
const int inf = (1 ? 0x3f3f3f3f : 0x7fffffff);
const int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 };
const ll INF = (1 ? 0x3f3f3f3f3f3f3f3f : 0x7fffffffffffffff);
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll poww(ll a, ll b) { ll s = 1; while (b) { if (b & 1)s = (s * a) % mod; a = (a * a) % mod; b >>= 1; }return s % mod; }
/*----------------------------------------------------------------------------------------------------------------------*/

const int N = 1e6 + 11;
ll n,m;
int z[105];
void solve()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>z[i];
	sort(z,z+n);
	int sum=0;
	for(int i=0;i<n;i++)
	{
		sum+=z[i];
		if(sum==m)
		{
			swap(z[0],z[i]);
			if(z[i]!=z[n-1])swap(z[i],z[n-1]);	
			else
			{
				cout<<"NO"<<endl;
				return;
			}
			break;
		}
	}
	cout<<"YES"<<endl;
	for(int i=0;i<n-1;i++)cout<<z[i]<<' ';
	cout<<z[n-1]<<endl;
}


/*----------------------------------------------------------------------------------------------------------------------*/
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    ll T = 1;
    cin >> T;
    while (T--)solve();
    return 0;
}
