#include <bits/stdc++.h>
using namespace std;
int a[1005];
int check[1005];
int mex(int n) {
  for (long long int i = 0; i < 1004; i++) check[i] = 0;
  for (long long int i = 0; i < n; i++) check[a[i]]++;
  for (long long int i = 0; i < 1004; i++) {
    if (check[i] == 0) return i;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (long long int i = 0; i < n; i++) cin >> a[i];
    int flag = 0, ans = 0;
    vector<int> temp;
    while (true) {
      flag = 0;
      for (long long int i = 0; i < n - 1; i++) {
        if (a[i] > a[i + 1]) flag = 1;
      }
      if (flag == 0) break;
      int xx = mex(n);
      if (xx != n) {
        temp.push_back(xx);
        a[xx] = xx;
      } else {
        for (long long int j = 0; j < n; j++) {
          if (a[j] != j) {
            temp.push_back(j);
            a[j] = n;
            break;
          }
        }
      }
    }
    cout << temp.size() << "\n";
    for (long long int i = 0; i < temp.size(); i++) cout << temp[i] + 1 << " ";
    cout << "\n";
  }
  return 0;
}
