#include <bits/stdc++.h>
using namespace std;
void gogeta() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long MEX(long long arr[], long long n) {
  set<long long> s;
  for (long long i = 0; i <= n; i++) s.insert(i);
  for (long long i = 0; i < n; i++) s.erase(arr[i]);
  return *(s.begin());
}
bool isinc(long long arr[], long long n) {
  for (long long i = 0; i < n - 1; i++) {
    if (arr[i] > arr[i + 1]) return false;
  }
  return true;
}
int32_t main() {
  gogeta();
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long arr[n];
    for (long long i = 0; i < n; i++) cin >> arr[i];
    vector<long long> v;
    long long d = 0;
    bool vis[n];
    memset(vis, false, sizeof(vis));
    for (long long i = 0; i < 2 * n; i++) {
      if (isinc(arr, n)) break;
      long long mx = MEX(arr, n);
      if (mx < n) {
        if (!vis[mx]) {
          vis[mx] = true;
          arr[mx] = mx;
          v.push_back(mx + 1);
        } else {
          vis[mx - 1] = true;
          arr[mx - 1] = mx;
          v.push_back(mx);
        }
      }
      if (mx == n) {
        v.push_back(n);
        arr[n - 1] = mx;
      }
    }
    cout << v.size() << endl;
    for (auto x : v) cout << x << " ";
    cout << endl;
  }
}
