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

int main()
{
   int t;cin>>t;
   while(t--){
    int n,x;
    cin>>n>>x;
    if(n==1){ int a;cin>>a;
        if(x==a){
            cout<<"NO"<<endl;
           continue;
        }
        else{
            cout<<"YES"<<endl<<a<<endl;
           continue;
        }
    }

    vector<int> v(n);
    int z=0;
    for(int i=0;i<n;i++){
        cin>>v[i];
        z+=v[i];
    }
    if(z==x){
        cout<<"NO"<<endl;
        continue;
    }
    int sum=0;
    for(int i=0;i<n;i++){
        sum+=v[i];
        if(sum==x){
            swap(v[i],v[i+1]);
        }
    }
    cout<<"YES"<<endl;
    for(int i=0;i<n;i++){
        cout<<v[i]<<" ";
    }
   cout<<endl;
   }

}
