/** Bismillahir Rahmanir Rahim **/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define endl '\n'
#define fi first
#define se second
#define ull unsigned ll
#define Fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define debug(x) cerr << #x << " " << x << endl

int main()
{
   Fastio;
   int tt, n, x; cin >> tt;
   while (tt--) {
      cin >> n >> x;
      vector<int> v(n);
      for (auto &x : v) cin >> x;
      sort(v.begin(), v.end());
      int sm = 0;
      bool ok = 1;
      for (int i = 0; i < n; i++) {
         sm += v[i];
         if (sm == x) {
            if (i + 1 >= n) {
               ok = false;
               break;
            }
            swap(v[i], v[i + 1]);
            break;
         }
      }
      if (ok) {
         cout << "YES" << endl;
         for (auto it : v) cout << it << " ";
      } else cout << "NO" << endl;
      cout << endl;
   }
    
   return 0;
}