#include <bits/stdc++.h>
using namespace std;
#define int long long
using vec = vector<int>;
using vvec = vector<vec>;
using bvec = vector<bool>;
using pii = pair<int,int>;
#define VECT(T) vector<T>
#define PRINT(vector) for(auto ele : vector) cout << ele << " "; cout << "\n";
constexpr int E9 = 1e9 + 7;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--) {
int n, k;
cin >> n >> k;
set<int> s;
for(int i = 0 ; i < k ; ++i) {
int a; cin >> a;
s.insert(a);
}
if(a.count(1)) a.erase(1);
else a.insert(1);
for(auto a : s) cout << a << " ";
cout << endl;
}
}