#include <bits/stdc++.h>
using namespace std;
string numtostr(long long n) {
  ostringstream str1;
  str1 << n;
  return str1.str();
}
long long strtonum(string s) {
  long long x;
  stringstream str1(s);
  str1 >> x;
  return x;
}
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
  long long gcd = GCD(a, b);
  return (a * b) / gcd;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v;
    map<long long, long long> m;
    long long mismatch = 0;
    for (long long i = 0; i <= n - 1; i++) {
      long long a;
      cin >> a;
      v.push_back(a);
      if (v[i] != i) m[i] = 1;
    }
    vector<long long> result;
    while (m.size()) {
      map<long long, long long> m2;
      for (long long i = 0; i <= n - 1; i++) m2[v[i]] = 1;
      long long mex = n;
      for (long long i = 0; i <= n - 1; i++) {
        if (m2[i] == 0) {
          mex = i;
          break;
        }
      }
      if (mex < n) {
        v[mex] = mex;
        m.erase(mex);
        result.push_back(mex + 1);
      } else {
        auto it = m.begin();
        v[it->first] = mex;
        result.push_back(it->first + 1);
      }
    }
    cout << result.size() << endl;
    if (result.size() != 0)
      for (long long i = 0; i <= result.size() - 1; i++)
        cout << result[i] << " ";
    cout << endl;
  }
  return 0;
}
