#include <bits/stdc++.h>
using namespace std;
int mex(vector<int>& a) {
  set<int> exists;
  for (auto& elem : a) {
    exists.insert(elem);
  }
  for (int i = 0; i < ((int)(a).size() + 1); ++i) {
    if (exists.count(i) == 0) {
      return i;
    }
  }
  return -1;
}
bool done(vector<int>& a) {
  for (int i = 0; i < ((int)(a).size()); ++i)
    if (a[i] != i) {
      return false;
    }
  return true;
}
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  vector<int> ans;
  while (!done(a)) {
    int temp = mex(a);
    if (temp == n) {
      for (int j = 0; j < (n); ++j)
        if (a[j] != j) {
          ans.push_back(j);
          a[j] = temp;
          break;
        }
    } else {
      ans.push_back(temp);
      a[temp] = temp;
    }
  }
  cout << (int)(ans).size() << endl;
  for (auto& elem : ans) cout << elem + 1 << " ";
  cout << endl;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int t;
  cin >> t;
  while (t--) solve();
}
