#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void imp() { cout << "NO\n"; }
void evencase(int n, int k, vector<int> &f) {
for (int c = 1; c <= k; c++) if (f[c] % 2 == 1) return imp();
cout << "YES\n";
vector<int> res;
for (int c = 1; c <= k; c++) for (int i = 0; i < f[c] / 2; i++) res.push_back(c);
for (int e : res) cout << e << " ";
reverse(res.begin(), res.end());
for (int e : res) cout << e << " ";
cout << "\n";
}
void solve() {
int n, k;
cin >> n >> k;
vector<int> f(k + 1);
for (int i = 0; i < n; i++) int c, cin >> c, f[c]++;
if (n % 2 == 0) return evencase(n, k, f);
int m = n / 2, oddcnt = 0, onecnt = 0;
for (int c = 1; c <= k; c++) oddcnt += f[c] & 1, onecnt += (f[c] == 1);
int comps = oddcnt / 2;
if (onecnt > 1 || comps > m / 3) return imp();
cout << "YES\n";
vector<int> resa(m), resb(m);
for (int i = 0; i < comps; i++) {
resb[i] = resa[3 * comps - (i + 1)] = resb[3 * comps - 2 * (i + 1)] = (i + 1) * (comps % 2 + 1);
resa[i] = resa[i + comps] = resb[2 * i + comps + 1] = oddcnt - resb[i];
}
vector<int> oddies;
for (int c = 1; c <= k; c++) if (f[c] & 1) {
oddies.push_back(c);
if (f[c] == 1) swap(oddies.back(), oddies.front());
}
for (int &e : resa) if (e) f[oddies[e]]--, e = oddies[e];
for (int &e : resb) if (e) f[oddies[e]]--, e = oddies[e];
f[oddies[0]]--;
stack<int> stck;
for (int c = 1; c <= k; c++) for (int i = 0; i < f[c]; i += 2) stck.push(c);
for (int i = 0; i < m; i++) if (resa[i] == 0) {
resa[i] = resb[i] = stck.top();
stck.pop();
}
reverse(resb.begin(), resb.end());
for (int e : resb) cout << e << " ";
cout << oddies[0];
for (int e : resa) cout << " " << e;
cout << "\n";
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
int t, cin >> t;
while (t--) solve();
return 0;
}