#include <bits/stdc++.h>
using namespace std;
vector<int> s;
int head[100005];
int cnt = 0;
int need[100005];
int ok[100005];
int seq[100005];
int n, k;
bool flag = false;
struct Tree {
  int val;
  int next;
} tr[200005];
void add(int x, int y) {
  tr[cnt].val = y;
  tr[cnt].next = head[x];
  head[x] = cnt++;
}
void dfs(int x, int fa) {
  int i, j;
  if (ok[x] == 2) return;
  ok[x] = 1;
  ok[x] = 1;
  for (i = head[x]; i != -1; i = tr[i].next) {
    int son = tr[i].val;
    if (ok[son] == 1) {
      cout << -1;
      exit(0);
    }
    if (son == fa) continue;
    dfs(son, x);
  }
  ok[x] = 2;
  s.push_back(x);
}
int main() {
  scanf("%d%d", &n, &k);
  memset(head, -1, sizeof(head));
  memset(seq, 0, sizeof(seq));
  int i;
  for (i = 1; i <= n; i++) ok[i] = false;
  for (i = 1; i <= k; i++) scanf("%d", &need[i]);
  for (i = 1; i <= n; i++) {
    int tmp;
    scanf("%d", &tmp);
    if (tmp == 0) continue;
    while (tmp--) {
      int x;
      scanf("%d", &x);
      add(i, x);
    }
  }
  for (i = 1; i <= k; i++) {
    dfs(need[i], -1);
  }
  cout << s.size() << endl;
  for (i = 0; i < s.size(); i++) cout << s[i] << " ";
  return 0;
}
