#include<bits/stdc++.h>
using namespace std; 
#define max(a, b) (a < b ? b : a) 
#define min(a, b) ((a > b) ? b : a) 
#define mod 1e9 + 7 
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++) 
#define FORL(a, b, c) for (int(a) = (b); (a) < (c); (a)++) 
#define FORR(a, b, c) for (int(a) = (b); (a) > (c); (a)--) 
#define INF 1000000000000000003 
typedef long long int ll; 
typedef vector<int> vi; 
typedef vector<long long int> vl; 
typedef pair<int, int> pi; 
typedef pair<long long int, long long int> pl; 
#define F first 
#define S second 
#define pb push_back 
#define POB pop_back 
#define mp make_pair 
ll m=mod;
void solve(){
     ll n,m,x=0,f=0;
     cin>>n>>m;
     vl a(n);
     FOR(i,n)
     {cin>>a[i];
     x+=a[i];
     }
     if(m==0||m==x)
     cout<<"NO"<<endl;
     else
     {cout<<"YES"<<endl;
     x=0;
         FOR(i,n)
         {  
             if(x+a[i]==m)
             {cout<<a[i+1]<<" "<<a[i]<<" ";
             f=1;
             x+=(a[i]+a[i+1]);
             }
             else if(f)
             {
                 f=0;
                 continue;
             }
             else
             {cout<<a[i]<< " ";
             x+=a[i];
             }
             
         }
          cout<<endl;
     }
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    long t;
    cin>>t  ;
     //t=1;
    while(t--)
    {
    solve();
    }
    return 0;
}
