#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    int t;
    cin >> t;
    for (int tc=1; tc<=t; tc++) {
        int n, x;
        cin >> n >> x;
        vector<int> v(n);
        for (int i=0; i<n; i++) {
            cin >> v[i];
        }
        vector<int> ans;
        int sum = 0;
        bool ok = true;
        for (int i=0; i<n; i++) {
            int val = v[i];
            if (sum + val == x) {
                if (i == n-1) {
                    ok = false;
                    break;
                }
                swap(v[i], v[n-1]);
                val = v[i];
            }
            ans.push_back(val);
            sum += val;
        }
        if (!ok) {
            cout << "NO\n";
            continue;
        }
        cout << "YES\n";
        for (int i=0; i<n; i++) {
            cout << ans[i] << " \n"[i+1==n];
        }
    }
}
