#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int find_mex(vector<int> a) {
  map<int, int> ch;
  for (auto i : a) ch[i] = 1;
  for (int i = 0; i <= a.size(); i++)
    if (ch[i] == 0) return i;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int mex;
    vector<int> ans;
    int ok = 0;
    while (!is_sorted(a.begin(), a.end())) {
      mex = find_mex(a);
      if (mex < n)
        a[mex] = mex, ans.push_back(mex), ok++;
      else {
        for (int j = 0; j < n; j++) {
          if (a[j] != j) {
            a[j] = mex;
            ans.push_back(j);
            break;
          }
        }
      }
    }
    cout << ans.size() << endl;
    for (auto i : ans) cout << i + 1 << " ";
    cout << endl;
  }
}
