#include <bits/stdc++.h>
const int N = 100005;
const long double pi = 3.141592653;
const long long MOD = 1000000007;
using namespace std;
int dx[9] = {1, -1, 0, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 0, 1, -1, 1, -1, 1, -1, 0};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n, i, j, mex;
    cin >> n;
    vector<int> a(n), ans;
    for (i = 0; i < n; i++) cin >> a[i];
    while (ans.size() < 2 * n) {
      for (j = 1; j < n; j++) {
        if (a[j] < a[j - 1]) break;
      }
      if (j == n)
        break;
      else {
        vector<bool> vis(n + 1, false);
        for (j = 0; j < n; j++) vis[a[j]] = true;
        for (j = 0; j < n + 1; j++) {
          if (vis[j] == false) {
            mex = j;
            break;
          }
        }
        if (mex == n) {
          for (j = 0; j < n; j++) {
            if (a[j] != j) {
              a[j] = mex;
              ans.push_back(j + 1);
              break;
            }
          }
        } else {
          a[mex] = mex;
          ans.push_back(mex + 1);
        }
      }
    }
    cout << ans.size() << "\n";
    for (i = 0; i < ans.size(); i++) cout << ans[i] << " ";
    cout << "\n";
  }
  return 0;
}
