#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm> 
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include  <ctime>
#include <iomanip>
#include <bitset>
#include <assert.h>   
#include <math.h>
using namespace std;
 
#define int                   long long int
#define uint                  unsigned long long int
#define loop(i,a,b)           for(int i=(int)a;i<(int)b;++i)
#define rloop(i,a,b)          for(int i=(int)a;i<=(int)b;++i)
#define loopl(i,a,b)          for(int i=(int)a;i<(int)b;++i)
#define loopr(i,a,b)          for(int i=(int)a;i>=(int)b;--i)
#define count_1(n)            __builtin_popcountint(n)
#define pb                    push_back
#define eb                    emplace_back
#define ab(a)                 (a<0)?(-1*a):a
#define pc                    putchar
#define gc                    getchar
#define mset(a,b,c)           loop(i,0,b) a[i]=c
#define mp                    make_pair
#define itoc(c)               ((char)(((int)'0')+c))
#define aint(p)                p.begin(),p.end()
#define max(x,y)              ((x>y)?x:y)
#define min(x,y)              ((x<y)?x:y)
#define mid(s,e)              (s+(e-s)/2)
#define vi                    vector<int>
#define vvi                   vector<vector<int>>
 
const int MOD = 1000000007;
 
int modpow(int a, int b, int mod) { int res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a; res %= mod; a = a * a; a %= mod; }return res; }
int p(int a, int b) { int res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a; a = a * a; }return res; }
int gcd (int a, int b) { return b ? gcd (b, a % b) : a; }


void testcases(int test) {
    int n,x; cin>>n>>x;
    vi a(n); loop(i,0,n) cin>>a[i];
    vi psum(n); psum[0] = a[0];

    int ind = -1; if(psum[0] == x) ind = 0;
    loop(i,1,n) { psum[i] = psum[i-1] + a[i]; if(psum[i] == x) ind = i; }
    
    if(psum[n-1] == x) { cout << "NO\n"; return; }
    if(ind != -1) swap(a[ind], a[ind+1]);
    cout << "YES\n";
    loop(i,0,n) cout << a[i] << " "; cout << "\n";
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /* code */ 
    int t; 
    cin >> t;
    // t = 1;
    loop(i,0,t) testcases(i);
    /* end code */
}