// WA

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int q;
    cin >> q;
    for (int qi = 0; qi < q; ++qi) {
        int n, c;
        cin >> n >> c;
        vector<int> t(n);
        for (int i = 0; i < n; ++i) cin >> t[i];
        ranges::sort(t);
        cout << "YES\n";
        for (int i = 0; i < n; ++i) {
            cout << t[i] << " ";
        }
        cout << "\n";
    }
}
