#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1e9;
const long long N = 1000 + 5;
long long ar[N], done[N], cnt[N];
long long n;
long long mex() {
  for (long long i = 0; i < n; i++) cnt[i] = 0;
  for (long long i = 0; i < n; i++) cnt[ar[i]] = 1;
  long long mex = 0;
  while (cnt[mex]) mex++;
  return mex;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    cin >> n;
    for (long long i = 0; i < n; i++) {
      cin >> ar[i];
    }
    vector<long long> ans;
    while (1) {
      long long m = mex();
      if (m < n) {
        ar[m] = m;
        ans.push_back(m + 1);
      } else {
        long long ind = 0;
        while (ind < n && ar[ind] == ind) ind++;
        if (ind == n) break;
        long long p = -1;
        for (long long i = 0; i < n && p == -1; i++)
          if (ar[i] == ind) p = i;
        ar[p] = n;
        ans.push_back(p + 1);
      }
    }
    cout << ans.size() << '\n';
    for (auto &inx : ans) cout << inx << " ";
    cout << '\n';
  }
}
