#include <bits/stdc++.h>
using namespace std;
class solver {
 public:
  int n;
  int a[2000] = {}, arr[2000] = {}, done[2000] = {};
  int mex() {
    for (int i = 0; i <= n; i++) {
      if (arr[i] == 0) return i;
    }
  }
  int fun() {
    for (int i = 1; i <= n; i++) {
      if (done[i] == 0) return i;
    }
    return -1;
  }
  void solve() {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) arr[a[i]]++;
    vector<int> ans;
    for (int i = 1; i <= 2 * n; i++) {
      int tmp = mex();
      if (tmp == 0) {
        int ix = fun();
        if (ix == -1) break;
        ans.push_back(ix);
        arr[a[ix]]--;
        a[ix] = tmp;
        arr[a[ix]]++;
      } else {
        int ix = tmp;
        ans.push_back(ix);
        arr[a[ix]]--;
        a[ix] = tmp;
        arr[a[ix]]++;
        done[ix] = 1;
      }
    }
    cout << ans.size() << '\n';
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
    cout << '\n';
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solver o;
    o.solve();
  }
  return 0;
}
