#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstring>
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define bug(str, x)     cerr << "# " << str << " : " << x << '\n'
#define here(x)         cerr << "here " << x << '\n'

using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
const int inf = 1e9;
int a[maxn];

int main(){
	ios;
	int t;
	cin >> t;
	while(t--){
		int n, x;
		cin >> n >> x;
		int sum = 0;
		for(int i = 0; i < n; i ++){
			cin >> a[i];
			sum += a[i];
		}
		if(sum == x){
			cout << "NO\n";
			continue;
		}
		sum = 0;
		for(int i = 0; i < n; i ++){
			sum += a[i];
			if(sum > x){
				break;
			}
			if(sum == x){
				swap(a[i], a[i + 1]);
				break;
			}
		}
		cout << "YES\n";
		for(int i = 0; i < n; i ++){
			cout << a[i] << ' ';
		}
		cout << '\n';
	}
}

