#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
int a[1002], b[1002];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, c = 0;
    cin >> n;
    for (int i = 0; i < (int)(n); ++i) {
      cin >> a[i];
      if (a[i] != i) c++;
    }
    vector<int> v;
    while (c > 0) {
      for (int i = 0; i < (int)(n + 1); ++i) b[i] = -1;
      for (int i = 0; i < (int)(n); ++i) b[a[i]] = 1;
      int j = 0;
      while (b[j] != -1) j++;
      if (j == n) {
        int k = 0;
        while (a[k] == k) k++;
        a[k] = n;
        v.push_back(k + 1);
        continue;
      }
      a[j] = j;
      v.push_back(j + 1);
      c--;
    }
    cout << v.size() << "\n";
    for (auto x : v) cout << x << " ";
    cout << "\n";
  }
}
