#include <bits/stdc++.h>
using namespace std;
long long n, m, k, x, y;
long long queries = 0;
long long a[300500];
long long b[20050], used[1005];
set<long long> g[1005];
long long mex() {
  for (int j = 0; j <= n; j++) {
    b[j] = 0;
  }
  for (int i = 1; i <= n; i++) {
    b[a[i]] = 1;
  }
  for (int i = 0; i <= n; i++) {
    if (b[i] == 0) {
      return i;
    }
  }
}
void print() {
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  cout << "\n";
}
bool good() {
  for (int i = 2; i <= n; i++) {
    if (a[i] < a[i - 1]) {
      return false;
    }
  }
  return true;
}
vector<long long> f;
vector<long long> ans;
vector<long long> tmp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    ans.clear();
    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    for (int i = 1; i <= n; i++) {
      used[i] = 0;
    }
    ans.clear();
    if (!good()) {
      for (int i = 0; i < 2 * n; i++) {
        long long s = mex();
        long long p = s;
        if (s == 0 || used[s]) {
          p = s + 1;
        }
        used[p] = 1;
        ans.push_back(p);
        a[p] = s;
        if (good()) {
          break;
        }
      }
    }
    cout << ans.size() << "\n";
    for (auto x : ans) {
      cout << x << " ";
    }
    cout << "\n";
  }
  return 0;
}
