#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
int a[maxn];
int ans[maxn << 1];
int vis1[maxn], vis[maxn];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    int res = n;
    int p = 0;
    int mex;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      vis1[i] = 0;
    }
    while (res > 0) {
      for (int i = 0; i <= n; i++) vis[i] = 0;
      for (int i = 1; i <= n; i++) vis[a[i]] = 1;
      for (int i = 0;; i++) {
        if (!vis[i]) {
          mex = i;
          break;
        }
      }
      if (mex == 0) {
        for (int i = 1; i <= n; i++) {
          if (!vis1[i]) {
            a[i] = mex;
            ans[++p] = i;
            break;
          }
        }
      } else {
        ans[++p] = mex;
        a[mex] = mex;
        vis1[mex] = 1;
        res--;
      }
    }
    printf("%d\n", p);
    for (int i = 1; i <= p; i++) printf("%d ", ans[i]);
    printf("\n");
  }
  return 0;
}
