#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long N = 200005;
int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long powb(long long a, long long b) {
  long long res = 1;
  a;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a;
    a = a * a;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> res;
    while (1) {
      vector<int> inarr(n, 0);
      for (int i = 0; i < n; i++)
        if (a[i] < n) inarr[a[i]]++;
      int mex = 0;
      while (mex < n && inarr[mex]) mex++;
      bool ok = true;
      if (mex == n) {
        for (int i = 0; i < n; i++) {
          if (a[i] != i) {
            res.push_back(i + 1);
            ok = false;
            a[i] = n;
            break;
          }
        }
        if (ok) break;
      } else {
        res.push_back(mex + 1);
        a[mex] = mex;
      }
    }
    assert(((int)(res).size()) <= 2 * n);
    cout << ((int)(res).size()) << "\n";
    for (auto i : res) cout << i << " ";
    cout << "\n";
  }
}
