#include<bits/stdc++.h>
using namespace std;
int main()
{
   int t;
   cin >> t;
   while(t--)
   {
      int n,x;
      cin >> n >> x;
      int a[n];
      for(int i=0;i<n;i++)
      {
         cin >> a[i];
      }
      int sum = 0;
      for(int i=0;i<n-1;i++)
      {
         sum += a[i];
         if(sum == x)
         {
            swap(a[i],a[i+1]);
         }
      }
      sum += a[n-1];
      if(sum == x)
      {
         cout << "NO" << "\n";
      }
      else
      {
         cout << "YES" << "\n";
         for(int i=0;i<n;i++)
         {
            cout << a[i] << " ";
         }
         cout << "\n";
      }
   }
   return 0;
}