#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> vec(n);
    for (long long &i : vec) cin >> i;
    vector<long long> ans;
    while (n) {
      vector<bool> has(n + 1, false);
      for (long long i = 0; i < n; i++) has[vec[i]] = true;
      long long x = 0;
      while (has[x]) x++;
      if (x == n) {
        n--;
        vec[n] = x;
        ans.push_back(n);
      } else {
        vec[x] = x;
        ans.push_back(x);
      }
    }
    cout << ans.size() << '\n';
    for (long long i : ans) cout << i + 1 << " ";
    cout << '\n';
  }
  return 0;
}
