//Bishmillahir Rahmanir Raheem
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
#define pll pair<ll,ll>
#define vp vector<pair<ll,ll>>
#define pb push_back
#define ff first
#define ss second
#define pi acos(-1.0)
#define tan(a) atan(a)/(pi/180)
#define sin(a) asin(a)/(pi/180)
#define cos(a) cos(a)/(pi/180)
#define test ll tc;cin>>tc; while(tc--){solve();}
#define max   99999999
#define inf   1<<30
#define eps   1e-9
#define mod   1000000007
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define case(tc) cout << "Case " << tc <<": "
#define all(qz) qz.begin(),qz.end()
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;

void iofun() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

ll Pow(ll c, ll d) {return d == 0 ? 1 : c * pow(c, d - 1);}
ll gcd(ll a, ll b) {return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b) {return ((a * b) / gcd(a, b));}

void solve()
{
	int n, x, pos[1001] = {0}, posin = 0;
	ll sum = 0;
	cin >> n >> x;
	int a[n + 10];
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		sum += a[i];
	}
	if (sum == x)
	{
		no;
	}
	else
	{
		yes;
		sum = 0;
		for (int i = 0; i < n; ++i)
		{
			sum += a[i];
			if (sum == x)
			{
				pos[posin] = i;
				posin++;
				sum -= a[i];
				continue;
			}
			cout << a[i] << ' ';
		}
		for (int i = 0; i < posin; ++i)
		{
			cout << a[pos[i]] << ' ';
		}
		cout << endl;
	}

}


int main()
{
	faster;
	iofun();
	test;
	return 0;
}