#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, in[maxn];
vector<int> co, vv[maxn], rv[maxn], ans;
void Get() {
  int i, j, h;
  bool vvis[maxn] = {0};
  memset(in, 0, sizeof(in));
  queue<int> q;
  while (q.size()) q.pop();
  for (i = 0; i < co.size(); i++) {
    if (vvis[co[i]]) continue;
    q.push(co[i]);
    vvis[co[i]] = 1;
    while (q.size()) {
      h = q.front();
      q.pop();
      for (j = 0; j < rv[h].size(); j++) {
        in[rv[h][j]]++;
        if (vvis[rv[h][j]]) continue;
        q.push(rv[h][j]);
        vvis[rv[h][j]] = 1;
      }
    }
  }
}
void solve() {
  int i, j, k, h, cnt = 0, s[maxn] = {0};
  bool vvis[maxn] = {0};
  queue<int> q;
  while (q.size()) q.pop();
  for (i = 1; i <= n; i++) {
    if (in[i] == 0) q.push(i);
  }
  while (q.size()) {
    h = q.front();
    q.pop();
    s[++cnt] = h;
    for (i = 0; i < vv[h].size(); i++) {
      in[vv[h][i]]--;
      if (in[vv[h][i]] == 0) q.push(vv[h][i]);
    }
  }
  for (i = 1; i <= cnt; i++) vvis[s[i]] = 1;
  for (i = 0; i < co.size(); i++) {
    if (!vvis[co[i]]) break;
  }
  if (i != co.size()) {
    cout << -1;
    return;
  }
  Get();
  for (i = 0; i < co.size(); i++) {
    if (in[co[i]] == 0) q.push(co[i]);
  }
  while (q.size()) {
    h = q.front();
    q.pop();
    ans.push_back(h);
    for (i = 0; i < rv[h].size(); i++) {
      in[rv[h][i]]--;
      if (in[rv[h][i]] == 0) q.push(rv[h][i]);
    }
  }
  cout << ans.size() << endl;
  for (i = ans.size() - 1; i >= 0; i--) printf(i ? "%d " : "%d\n", ans[i]);
}
int main() {
  int t, q, i, j, k, cnt, tmp, v;
  cin >> n >> t;
  for (; t; t--) {
    scanf("%d", &tmp);
    co.push_back(tmp);
  }
  for (i = 1; i <= n; i++) {
    scanf("%d", &k);
    for (; k; k--) {
      scanf("%d", &v);
      vv[v].push_back(i);
      rv[i].push_back(v);
      in[i]++;
    }
  }
  solve();
  return 0;
}
