#include <bits/stdc++.h>
using namespace std;
int mex(vector<int> a, int n) {
  set<int> s;
  for (int i = 0; i < n; i++) {
    s.insert(a[i]);
  }
  int i = 0;
  for (auto x : s) {
    if (x != i) return i;
    i++;
  }
  return n;
}
int unfixedIndex(vector<int> a, int n) {
  for (int i = 0; i < n; i++) {
    if (a[i] != i) return i;
  }
  return -1;
}
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int i = 0;
  vector<int> index;
  int is = 0;
  while (i < 2 * n) {
    int mex1 = mex(a, n);
    if (mex1 == n) {
      int unf = unfixedIndex(a, n);
      if (unf == -1) break;
      a[unf] = n;
      index.push_back(unf);
      is++;
    } else {
      a[mex1] = mex1;
      index.push_back(mex1);
      is++;
    }
    i++;
  }
  cout << is;
  cout << "\n";
  for (auto x : index) {
    cout << x + 1 << " ";
  }
  cout << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
