#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int n, v[MAXN];
int mex() {
  set<int> s;
  for (int i = 0; i <= n; i++) s.insert(i);
  for (int i = 1; i <= n; i++) s.erase(v[i]);
  return (*s.begin());
}
void solve() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &v[i]);
  printf("%d\n", 2 * n);
  for (int i = 0; i < 2 * n; i++) {
    int m = mex();
    if (m == n) {
      int id = n;
      for (int i = 1; i < n; i++)
        if (i - 1 != v[i]) id = i;
      v[id] = n;
      printf("%d ", id);
      continue;
    }
    v[m + 1] = m;
    printf("%d ", m + 1);
  }
  printf("\n");
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
}
