#include <bits/stdc++.h>
using namespace std;
int po(vector<int> x) {
  int p = -1;
  int min = INT_MAX;
  for (int i = 0; i < x.size(); i++) {
    if (x[i] != i) {
      if (min > x[i]) {
        p = i;
        min = x[i];
      }
    }
  }
  return p;
}
int mex(vector<int> x) {
  vector<int> p(x.size() + 1, 0);
  for (int i = 0; i < x.size(); i++) {
    p[x[i]]++;
  }
  int ans = 0;
  while (ans < p.size() && p[ans] != 0) {
    ans++;
  }
  return ans;
}
int main() {
  int test;
  cin >> test;
  while (test--) {
    int n;
    cin >> n;
    vector<int> x;
    for (int i = 0; i < n; i++) {
      int t;
      cin >> t;
      x.push_back(t);
    }
    int p = mex(x);
    vector<int> ans;
    int pos = po(x);
    while (pos != -1) {
      x[pos] = mex(x);
      p = mex(x);
      ans.push_back(pos + 1);
      while (p != n) {
        x[p] = p;
        ans.push_back(p + 1);
        p = mex(x);
      }
      pos = po(x);
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i] << " ";
    }
    cout << endl;
  }
}
