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