#include <bits/stdc++.h>
using namespace std;
int mex(int h[]) {
  int i;
  for (i = 0; i < 1001; i++) {
    if (h[i] == 0) return i;
  }
  return -1;
}
bool check(int a[], int n) {
  int i;
  for (i = 0; i < n - 1; i++) {
    if (a[i] > a[i + 1]) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t, n, i, m;
  cin >> t;
  while (t--) {
    cin >> n;
    int a[n];
    int h[1002] = {0};
    vector<int> v;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      h[a[i]]++;
    }
    while (!check(a, n)) {
      m = mex(h);
      h[m]++;
      if (m == n) {
        for (i = 0; i < n; i++) {
          if (a[i] != i) break;
        }
        h[a[i]]--;
        a[i] = m;
        v.push_back(i + 1);
      } else {
        h[a[m]]--;
        a[m] = m;
        v.push_back(m + 1);
      }
    }
    cout << v.size() << endl;
    for (i = 0; i < v.size(); i++) cout << v[i] << " ";
    cout << endl;
  }
}
