// link - 
#pragma region

#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define pb push_back
using namespace std;

void init(){
    
    #ifndef ONLINE_JUDGE 
        freopen("./input.txt","r",stdin); 
    #endif
    
    std::ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
}

void test();

int main(){
    
    init();
    int tc; cin>>tc;
    while(tc--){
        test();        
    }

    return 0;
}

#pragma endregion

/* input
3
3 2
3 2 1
5 3
1 2 3 4 8
1 5
5

*/ 
void yes(vi &arr){
    cout<<"YES\n";
    for(int z: arr) cout<<z<<" ";
    cout<<"\n";
}

void test(){
    int n,x; cin>>n>>x;
    vi arr(n,0);
    map<int,int> y;
    int tot = 0, minn = 10000;
    
    for(int i=0; i<n; i++) {
        cin>>arr[i];
        y[arr[i]]++;
        tot += arr[i];
        minn = min(minn,arr[i]);
    }
    
    if(x>tot || x<minn) { yes(arr); return; }
    if(x==tot) {cout<<"NO\n"; return;}

    if(y.size()==1 && x%arr[0] == 0){
        cout<<"NO\n"; return;
    } 

    sort(begin(arr),end(arr));
    
    int sum=0;
    for(int i=0; i<n-1; i++) {
        sum += arr[i];
        if(sum==x) {
            int j=i+1;
            while(j<n && arr[i]==arr[j]) j++;
            if(j==n){cout<<"NO\n"; return;}
            swap(arr[i],arr[j]);
            break;
        }
    }
    yes(arr);
}