#include<bits/stdc++.h>
#define ll long long
#define MAX -1
#define MIN 1e9
ll t;
using namespace std;
int main()
{
    cin>>t;
    while(t--)
    {

        ll n,k,i,j,l,m,o,p,sum=0;
        cin>>n>>k;
        ll ar[n];
        for(i=0; i<n; i++)
        {
            cin>>ar[i];

        }
        sort(ar,ar+n);
        ll x=accumulate(ar , ar+n , sum);

        if(x==k)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            ll s1=0;

            for(i=0; i<n; i++)
            {
                s1+=ar[i];

                if(s1==k)
                {
                    swap(ar[i],ar[i+1]);
                    break;

                }
            }
            cout<<"YES"<<endl;

            for(i=0; i<n; i++)
            {
                cout<<ar[i]<<" ";
            }
            cout<<endl;

        }
    }
}


