#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
typedef long long ll;
#define fast_cin()                    \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
using namespace std;
void solve()
{
    ll n, x;
    cin >> n >> x;
    ll a[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int w = 0;
    for (int i = 0; i < n; i++)
    {
        w += a[i];
        if (w == x)
        {
            if (i == n - 1)
            {
                cout << "NO" << endl;
                return;
            }
            else
            {
                int t = a[i];
                w -= a[i];
                w += a[i + 1];
                //Swap the numbers:
                a[i] = a[i + 1];
                a[i + 1] = t;
            }
        }
    }
    cout << "YES" << endl;
    for (int i = 0; i < n; i++)
    {
        cout << a[i] << " ";
    }
}

int main()
{
    fast_cin();
    int t;
    cin >> t;
    while (t--)
    {
        solve();
        cout << endl;
    }
}