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




void solve()
{

	int n, k;
	cin >> n >> k;

	int a[n];
	int total_sum = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		total_sum += a[i];
	}

	if (total_sum == k)
	{
		cout << "NO" << endl;
		return;
	}

	sort(a, a + n);

	int sum = 0, index=-1;
	for (int i = 0; i < n; i++)
	{
		sum += a[i];

		if (sum == k)
		{
			index = i;
			break;
		}

	}



	cout << "YES" << endl;
	for (int i = 0; i < n; i++)
	{
		if (i == index)
			continue;
		cout << a[i] << " ";
	}
	if(index!=-1)
	cout << a[index];
	cout << endl;


}




int main()
{

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

	int t;
	cin >> t;

	while (t--)
	{
		solve();
	}

	return 0;
}