#include <bits/stdc++.h>
#include <iostream>

using namespace std;
using ll = long long;

const int MAXN = 100 + 2;
int arr[MAXN];

ll fastExpo(ll a, ll b)
{
	ll res = 1LL;

	while (b)
	{
		if (b & 1LL)
			res *= a;

		if (res > 1e18)
			return res;
		a *= a;
		b >>= 1;
	}

	return res;
}

void solve()
{
	int n, x;
	cin >> n >> x;
	int sum = 0;

	int when = -1;
	for (int i = 0; i < n; ++i)
	{
		cin >> arr[i];
		sum += arr[i];
		if (sum == x)
			when = i;
	}

	if (when == n-1)
	{
		cout << "NO\n";
        return;
	}
	else if (when != -1)
	{
		swap(arr[when], arr[when+1]);
	}

    cout << "YES\n";
    // cout << "When is " << when << endl;
	for (int i = 0; i < n; ++i)
		cout << arr[i] << " ";

	cout << endl;
}

int main()
{
	int t = 1;
	cin >> t;

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

	return 0;
}