#include <bits/stdc++.h>

#define speedup ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr),cout.precision(12)
using namespace std;
using ll = long long;
#define pb push_back
#define all(x) (x).begin(),(x).end()

void solve() {
    int n, x;
    cin >> n >> x;
    vector<int> w(n);
    int sum = 0;
    for (auto &it:w) cin >> it, sum += it;
    if (sum == x) {
        cout << "NO\n";
        return;
    }
    cout << "YES\n";
    sort(all(w));
    sum = 0;
    for (int i = 0; i < n; ++i) {
        sum += w[i];
        if (sum == x) {
            swap(w[i], w[n - 1]);
            break;
        }
    }
    for (auto &it:w) cout << it << ' ';
    cout << '\n';
}

int main() {
    speedup;
    int t;
    cin >> t;
    while (t--)
        solve();
}
