#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int i, t, n;
  cin >> t;
  while (t--) {
    bool flag = true;
    int n;
    cin >> n;
    int a[n + 1];
    vector<int> v;
    for (int i = 0; i < n; i++) cin >> a[i];
    while (1) {
      flag = true;
      map<int, int> mp;
      for (int i = 0; i < n; i++) {
        if (i != 0 && a[i] < a[i - 1]) flag = false;
        mp[a[i]] = 1;
      }
      if (flag) break;
      for (int i = 0; i <= n; i++) {
        if (!mp[i]) {
          if (i == n) {
            for (int j = 0; j < n; j++) {
              if (a[j] != j) {
                v.push_back(j + 1);
                a[j] = i;
                break;
              }
            }
          } else {
            v.push_back(i + 1);
            a[i] = i;
          }
          break;
        }
      }
    }
    cout << v.size() << endl;
    for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
    cout << endl;
  }
  return 0;
}
