#include <bits/stdc++.h>
using namespace std;
int cnt = 0, n = 0;
bool isSorted(int arr[]) {
  for (int i = 0; i < n - 1; i++)
    if (arr[i] > arr[i + 1]) return false;
  return true;
}
int findMex(int arr[]) {
  set<int> st;
  for (int i = 0; i < n; i++) st.insert(arr[i]);
  for (int i = 0; i <= n; i++)
    if (st.find(i) == st.end()) return i;
}
void solve(int arr[]) {
  vector<int> vec;
  while (n) {
    int mex = findMex(arr);
    if (mex == n) {
      {
        vec.push_back(n - 1);
        arr[n - 1] = mex;
        n--;
      }
    } else {
      vec.push_back(mex);
      arr[mex] = mex;
    }
  }
  cout << vec.size() << "\n";
  for (int i : vec) cout << i + 1 << " ";
  cout << "\n";
  return;
}
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    cin >> n;
    int arr[1001];
    for (int i = 0; i < n; i++) cin >> arr[i];
    solve(arr);
  }
}
