#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    vector<int> res;
    while (n > 0) {
      vector<bool> was(n, false);
      for (int i = 0; i < n; i++) {
        if (a[i] < n) {
          was[a[i]] = true;
        }
      }
      int mex = 0;
      while (mex < n && was[mex]) {
        mex++;
      }
      if (mex == n) {
        res.push_back(n - 1);
        a[n - 1] = mex;
        --n;
        continue;
      }
      res.push_back(mex);
      a[mex] = mex;
    }
    cout << res.size() << endl;
    for (int x : res) {
      cout << x + 1 << " ";
    }
    cout << endl;
  }
}
