#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb(a) push_back(a)
#define pi pair<int,int>
#define f first
#define s second
#define vi vector<ll> 
#define vc vector<char>
void solve()
{
    ll n, x;
    cin >> n >> x;
    ll arr[n];
    set<ll> st;
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        st.insert(arr[i]);
        sum += arr[i];
    }
    if(sum == x) {
        cout << "NO\n";
        return;
    }
    sort(arr,arr+n);
    ll cur = 0;
    for (int i = 0; i < n; i++) {
        if(((cur + arr[i]) == x)&& (i < n)) {
            swap(arr[i],arr[i+1]);
            break;
        }
        cur += arr[i];
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++)
    cout << arr[i] << " ";
    cout << endl;
}                                                   
int main()
{
    int t;
    cin >> t;
    while(t--)
        solve();
} 