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

//shorthands
#define ll                long long
#define ld                long double
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define mkp               make_pair
#define fastio            ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (ll)((x).size())
#define fr                first
#define sc                second
#define vll               vector <ll>
#define vpll              vector < pair<ll,ll> >
#define vect(a,n)         vll a(n); rep(i,0,n) cin>>a[i];
#define rep(i,a,b)        for(ll i = a; i < b; i++)
#define PI                3.14159265358979323846


//Debug
#define printall(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<"\n";
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define deb3(x, y, z) cout << #x << "=" << x << "," << #y << "=" << y <<","<< #z << "=" << z << endl


//Constants
const int mod = (ll) 1e9 + 7 ;
const int INF = (int) 1e18 ;

//Input-Output File
void fileio(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif
}

void solve() {
    ll n,x; cin >> n >> x;
    vll v(n);
    rep(i,0,n) cin >> v[i];
    sort(all(v));
    ll sum = 0;
    rep(i,0,n) {
        sum += v[i];
        if(sum == x) {
            if(i+1 < n) {
                sum -= v[i];
                sum += v[i+1];
                swap(v[i] , v[i+1]);
            }
        }
    }
    if(sum == x) cout << "NO\n";
    else {
        cout << "YES\n";
        printall(v);
    }
}

int main() {
    fastio;
    fileio;
    int t; cin >> t;
    while(t--) solve();
}



