#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
long long int power(long long int a, long long int p, long long int m) {
  long long int re = 1;
  re %= m;
  for (; p; p >>= 1) {
    if (p & 1) re = re * a % m;
    a = a * a % m;
  }
  return re;
}
long long int getmex(long long int a[], long long int n) {
  int arr[n + 1];
  memset(arr, 0, sizeof(arr));
  for (long long int i = 0; i < n; i++) arr[a[i]] = 1;
  for (long long int i = 0; i <= n; i++) {
    if (arr[i] == 0) return i;
  }
}
bool checknd(long long int a[], long long int n) {
  int fl = 1;
  for (long long int i = 1; i < n; i++) {
    if (a[i] < a[i - 1]) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n];
    for (long long int i = 0; i < n; i++) cin >> a[i];
    vector<long long int> ans;
    while (1) {
      if (checknd(a, n)) break;
      long long int x = getmex(a, n);
      if (x == n) {
        for (long long int j = 0; j < n; j++) {
          if (a[j] != j) {
            a[j] = n;
            ans.push_back(j);
            break;
          }
        }
      } else {
        a[x] = x;
        ans.push_back(x);
      }
    }
    cout << ans.size() << endl;
    for (long long int i = 0; i < ans.size(); i++) cout << ans[i] + 1 << " ";
    cout << endl;
  }
}
