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


void solve() {
    int n, x;
    cin >> n >> x;
    vector<int> v(n);
    long long sum = 0;
    int max = -214700000;
    int min = 2147000000;
    int index;
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        sum += v[i];
        max = std::max(max, v[i]);
        if (max == v[i]) {
            index = i;
        }
        min = std::min(min, v[i]);
    }
    if (sum == x || ((min == max) && (max == x))) {
        cout << "NO" << '\n';
    } else {
        sort(v.begin(), v.end());
        index = v.size() - 1;
        long long summ = 0;
        for (int i = 0; i < n; ++i) {
            summ += v[i];
            if (summ == x) {
                summ -= v[i];
                summ += v[index];
                swap(v[index], v[i]);
                --index;
            }
        }
        cout << "YES" << '\n';
        for (auto i: v) {
            cout << i << ' ';
        }
        cout << '\n';
    }
}

int main() {
    int t;
    cin >> t;
    for (int i = 0; i < t; ++i) {
        solve();
    }
    return 0;
}
