#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define ulli unsigned long long int
#define pi 3.1415926535897932384626
#define p_b push_back
// numeric_limits<double>::max();
lli gcd(lli a, lli b) { if (b == 0) return a; return gcd(b, a % b); }
lli lcm(lli a, lli b) {return (a * b) / gcd(a, b);}
template <typename T>
T max3(T x, T y, T z) {return (max(max(x, y), z));}
template <typename T>
T min3(T x, T y, T z) {return (min(min(x, y), z));}

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

void solve()
{
	lli n, x, s;
	cin >> n >> x;
	queue<int> q;
	vector<int> ans;
	for (int i = 0; i < n; i++)
	{
		cin >> s;
		q.push(s);
	}
	int ct = 0;
	s = 0;
	while (!q.empty() && ct <= q.size())
	{
		/*if (q.front() == x)
		{
			q.push(q.front());
			q.pop();
			ct++;
			continue;
		}
		else*/ if ((q.front() + s) == x)
		{
			q.push(q.front());
			q.pop();
			ct++;
			continue;
		}
		else
		{
			ans.push_back(q.front());
			s += q.front();
			q.pop();
			ct = 0;
		}
	}
	if (q.empty())
	{
		cout << "YES\n";
		for (auto e : ans)
			cout << e << " ";
		cout << endl;
	}
	else
		cout << "NO" << endl;
}

int main()
{
	required();
	int t = 1;
	cin >> t;		//comment it for single test case
	while (t--)
	{
		solve();
	}
	return 0;
}

