#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n;
long long ar[1001];
bool check() {
  for (long long i = 1; i < n; i++) {
    if (ar[i] < ar[i - 1]) return false;
  }
  return true;
}
long long find() {
  set<long long> st;
  for (long long i = 0; i < n; i++) {
    st.insert(ar[i]);
  }
  for (long long i = 0; i <= n; i++) {
    if (st.find(i) == st.end()) {
      return i;
    }
  }
  return 0;
}
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (long long i = 0; i < n; i++) cin >> ar[i];
    long long ind = 0;
    vector<long long> ans;
    while (!check()) {
      long long mex = find();
      if (mex == n) {
        for (long long i = ind; i < n; i++) {
          if (ar[i] != i) {
            ans.push_back(i);
            ar[i] = mex;
            break;
          }
        }
      } else {
        ar[mex] = mex;
        ans.push_back(mex);
      }
    }
    cout << ans.size() << endl;
    for (long long i = 0; i < ans.size(); i++) {
      cout << ans[i] + 1 << " ";
    }
    cout << endl;
  }
  return 0;
}
