#include <bits/stdc++.h>
using namespace std;
long long fn(long long x, long long rn[]) {
  if (x == rn[x])
    return x;
  else
    return rn[x] = fn(rn[x], rn);
}
bool un(long long x, long long y, long long rn[], long long sz[]) {
  x = fn(x, rn);
  y = fn(y, rn);
  if (x == y) return false;
  if (sz[x] < sz[y]) swap(x, y);
  sz[x] += sz[y];
  rn[y] = x;
  return true;
}
bool compare(const pair<long long, long long>& a,
             const pair<long long, long long>& b) {
  return a.second < b.second;
}
pair<int, int> mostFrequent(long long arr[], long long n) {
  unordered_map<long long, long long> hash;
  for (long long i = 0; i < n; i++) hash[arr[i]]++;
  long long max_count = 0, res = -1;
  for (auto i : hash) {
    if (max_count < i.second) {
      res = i.first;
      max_count = i.second;
    }
  }
  pair<long long, long long> temp;
  temp.first = res;
  temp.second = max_count;
  return temp;
}
long long div(long long n) {
  if (n % 2 == 0) return 2;
  for (long long i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return i;
  }
  return n;
}
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long msum(long long a[], long long size) {
  long long max_so_far = a[0];
  long long curr_max = a[0];
  for (long long i = 0; i < size; i++) {
    curr_max = max(a[i], curr_max + a[i]);
    max_so_far = max(max_so_far, curr_max);
  }
  return max_so_far;
}
long long M = 1000000007;
long long power(long long x, long long y, long long m) {
  if (y == 0) return 1;
  long long p = power(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
bool cst(const pair<long long, long long>& a,
         const pair<long long, long long>& b) {
  return (a.second - a.first) < (b.second - b.first);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n];
    set<long long> st;
    map<long long, long long> ux;
    vector<long long> v;
    for (long long i = 0; i <= n - 1; i++) {
      cin >> a[i];
      ux[a[i]]++;
      st.insert(a[i]);
    }
    long long mx;
    for (long long j = 0; j <= 1000; j++) {
      if (st.count(j) == 0) {
        mx = j;
        break;
      }
    }
    while (1) {
      for (long long j = 0; j <= 1000; j++) {
        if (st.count(j) == 0) {
          mx = j;
          break;
        }
      }
      if (mx == n) {
        long long flag = 0;
        for (long long i = 0; i <= n - 1; i++) {
          if (a[i] != i) {
            flag = 1;
            ux[a[i]]--;
            if (ux[a[i]] == 0) {
              st.erase(st.find(a[i]));
            }
            a[i] = mx;
            ux[mx]++;
            st.insert(mx);
            v.push_back(i + 1);
            break;
          }
        }
        if (flag == 0) {
          break;
        } else {
          continue;
        }
      }
      if (a[mx] != mx) {
        ux[a[mx]]--;
        if (ux[a[mx]] == 0) {
          st.erase(st.find(a[mx]));
        }
        a[mx] = mx;
        ux[mx]++;
        st.insert(mx);
        v.push_back(mx + 1);
      }
    }
    cout << v.size() << "\n";
    for (long long i = 0; i <= (long long)v.size() - 1; i++) {
      cout << v[i] << " ";
    }
    cout << "\n";
  }
}
