#include <bits/stdc++.h>
using namespace std;
int n, m;
long long a[1005];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    scanf("%d", &n);
    vector<int> ans;
    for (int i = 1; i <= n; i++) {
      scanf("%lld", a + i);
    }
    for (int i = 1; i <= 2 * n; i++) {
      int now = 0;
      vector<int> cnt;
      for (int j = 1; j <= n; j++) cnt.push_back(a[j]);
      sort(cnt.begin(), cnt.end());
      for (int j = 0; j < cnt.size(); j++) {
        if (cnt[j] == now) now++;
      }
      if (now == n) {
        for (int j = 1; j <= n; j++) {
          if (a[j] != j - 1) {
            ans.push_back(j);
            a[j] = n;
            break;
          }
          if (j == n) i = 2 * n;
        }
      } else {
        if (a[now + 1] != now) ans.push_back(now + 1);
        a[now + 1] = now;
      }
    }
    cout << ans.size() << endl;
    for (auto it : ans) printf("%d ", it);
    printf("\n");
  }
}
