#include <bits/stdc++.h>
using namespace std;
mt19937_64 mt(time(0));
const int MAXN = 1234;
int nums[MAXN];
bool used[MAXN];
int mex(int n) {
  for (int i = 0; i <= n; i++) {
    used[i] = false;
  }
  for (int i = 0; i < n; i++) {
    used[nums[i]] = true;
  }
  for (int i = 0; i <= n; i++) {
    if (!used[i]) return i;
  }
  assert(false);
  return -1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  cout << fixed;
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> nums[i];
    }
    vector<int> ret;
    while (true) {
      int x = mex(n);
      if (x < n) {
        ret.push_back(x + 1);
        nums[x] = x;
      } else {
        bool done = true;
        for (int i = 0; i < n; i++) {
          if (nums[i] == i) continue;
          ret.push_back(i + 1);
          nums[i] = x;
          done = false;
          break;
        }
        if (done) break;
      }
    }
    assert(ret.size() <= 2 * n);
    cout << ret.size() << '\n';
    for (int i = 0; i < ret.size(); i++) {
      cout << ret[i];
      if (i + 1 == ret.size())
        cout << '\n';
      else
        cout << ' ';
    }
  };
  return 0;
}
