#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (auto& x : v) cin >> x;
  auto check = [&]() {
    for (int i = 1; i < n; i++) {
      if (v[i] < v[i - 1]) return false;
    }
    return true;
  };
  auto MEX = [&]() {
    vector<int> temp(n + 1);
    for (auto x : v) temp[x]++;
    for (int i = 0; i <= n; i++) {
      if (temp[i] == 0) return i;
    }
    assert(false);
  };
  vector<int> mv;
  while (!check()) {
    int mex = MEX();
    if (mex < n) {
      v[mex] = mex;
      mv.emplace_back(mex + 1);
    } else {
      int i = 0;
      while (v[i] == i) i++;
      v[i] = mex;
      mv.emplace_back(i + 1);
    }
  }
  cout << mv.size() << endl;
  for (auto x : mv) cout << x << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  int testcase;
  cin >> testcase;
  for (int i = 0; i < testcase; i++) {
    solve();
  }
  return 0;
}
