#include <bits/stdc++.h>
const uint64_t MOD = 1e9;
void ios() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
}
int32_t mx(std::vector<int32_t> a) {
  std::sort(a.begin(), a.end());
  int32_t mex = 0;
  for (auto &elem : a) {
    if (mex == elem) mex++;
  }
  return mex;
}
void solve() {
  int32_t n;
  std::cin >> n;
  std::vector<int32_t> a(n);
  std::vector<int32_t> ans;
  for (int32_t i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  bool flag = true;
  while (true) {
    int32_t i;
    flag = false;
    for (i = 0; i < n - 1; i++) {
      if (a[i] > a[i + 1]) {
        flag = true;
        break;
      }
    }
    if (!flag) break;
    auto x = mx(a);
    if (x == n) {
      for (int32_t j = 0; j < n; j++) {
        if (a[j] != j) {
          ans.push_back(j);
          a[j] = x;
          break;
        }
      }
    } else {
      a[x] = x;
      ans.push_back(x);
    }
  }
  std::cout << ans.size() << '\n';
  for (auto &elem : ans) {
    std::cout << elem + 1 << ' ';
  }
  std::cout << '\n';
}
int32_t main() {
  ios();
  size_t t;
  std::cin >> t;
  while (t-- > 0) {
    solve();
  }
  return 0;
}
