#include <bits/stdc++.h>
using namespace std;
long long get_mex(vector<long long>& a) {
  set<long long> s;
  for (long long i = 0; i < a.size(); i++) {
    s.insert(a[i]);
  }
  for (long long i = 0;; i++) {
    if (!s.count(i)) return i;
  }
}
bool check(vector<long long>& a) {
  for (long long i = 1; i < a.size(); i++) {
    if (a[i] < a[i - 1]) return false;
  }
  return true;
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> ans;
  while (!check(a)) {
    long long mx = get_mex(a);
    if (mx < n) {
      a[mx] = mx;
      ans.push_back(mx);
    } else {
      for (long long j = 0; j < n; j++) {
        if (a[j] != j) {
          a[j] = mx;
          ans.push_back(j);
          break;
        }
      }
    }
  }
  cout << ans.size() << "\n";
  for (auto u : ans) {
    cout << u + 1 << ' ';
  }
  cout << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout.precision(30);
  long long t = 1;
  cin >> t;
  while (t--) solve();
}
