#include <bits/stdc++.h>
using namespace std;
int n, k;
int book[100005], a[100005];
vector<int> g1[100005], g2[100005], order;
void build(int x) {
  book[x] = 1;
  for (int i = 0; i < g1[x].size(); i++) {
    int v = g1[x][i];
    g2[x].push_back(v);
    if (!book[v]) build(v);
  }
}
bool dfs(int x) {
  book[x] = -1;
  for (int i = 0; i < g2[x].size(); i++) {
    int v = g2[x][i];
    if (book[v] == -1)
      return 0;
    else if (!book[v] && !dfs(v))
      return 0;
  }
  order.push_back(x);
  book[x] = 1;
  return 1;
}
bool topu() {
  for (int i = 1; i <= k; i++)
    if (!book[a[i]] && !dfs(a[i])) return 0;
  return 1;
}
int main() {
  while (scanf("%d %d", &n, &k) != EOF) {
    memset(book, 0, sizeof(book));
    for (int i = 1; i <= k; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) {
      int t, v;
      scanf("%d", &t);
      for (int j = 0; j < t; j++) {
        scanf("%d", &v);
        g1[i].push_back(v);
      }
    }
    for (int i = 1; i <= k; i++) build(a[i]);
    memset(book, 0, sizeof(book));
    order.clear();
    if (topu()) {
      printf("%d\n", order.size());
      for (int i = 0; i < order.size(); i++) printf("%d ", order[i]);
      printf("\n");
    } else
      printf("-1\n");
    for (int i = 1; i <= n; i++) g1[i].clear(), g2[i].clear();
  }
}
