#include <bits/stdc++.h>
using namespace std;
long long a[1010];
long long b[1010];
long long c[2020];
long long d[1010];
long long mex(long long m) {
  sort(b, b + m);
  long long j = 0;
  long long k = 0;
  long long ans = m;
  while (j < m) {
    if (b[k] > j) {
      ans = j;
      break;
    } else if (b[k] == j) {
      k++;
      j++;
    } else {
      k++;
    }
  }
  return ans;
}
long long check(long long m) {
  long long ct3 = 0;
  for (long long i = 1; i < m; i++) {
    if (a[i] < a[i - 1]) {
      ct3 = 1;
      break;
    }
  }
  if (ct3 == 1)
    return 0;
  else
    return 1;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long ct = 1;
    long long ct1 = 0;
    for (long long i = 0; i <= n; i++) {
      a[i] = 0;
      b[i] = 0;
      c[i] = 0;
      d[i] = 0;
    }
    for (long long i = n; i <= (n + n); i++) {
      c[i] = 0;
    }
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      b[i] = a[i];
      if (a[i] == i) d[i] = 1;
    }
    while (ct <= (2 * n)) {
      if (check(n) == 1) break;
      ct1 = mex(n);
      if (ct1 == n) {
        for (long long i = 0; i < n; i++) {
          if (d[i] != 1) {
            a[i] = n;
            c[ct] = i;
            break;
          }
        }
      } else {
        c[ct] = ct1;
        a[ct1] = ct1;
        d[ct1] = 1;
      }
      for (long long i = 0; i < n; i++) b[i] = a[i];
      ct++;
    }
    cout << ct - 1 << '\n';
    for (long long i = 1; i < ct; i++) {
      cout << c[i] + 1 << " ";
    }
    cout << '\n';
  }
  return 0;
}
