#include <bits/stdc++.h>
using namespace std;
int n, k;
int need[100005];
vector<int> G[100005], _G[100005];
bool vis[100005];
int tem[100005], idx = 0;
void dfs1(int u) {
  vis[u] = true;
  for (int v : G[u])
    if (!vis[v]) dfs1(v);
  tem[idx++] = u;
}
int ID[100005], SZ[100005];
void dfs2(int u, int scc) {
  SZ[scc]++;
  ID[u] = scc;
  for (int v : _G[u])
    if (ID[v] == -1) dfs2(v, scc);
}
bool dfs3(int u) {
  vis[u] = true;
  if (SZ[u] != 1) return false;
  for (int v : _G[u])
    if (!vis[v] && !dfs3(v)) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= k; i++) cin >> need[i];
  for (int u = 1; u <= n; u++) {
    int m;
    cin >> m;
    while (m--) {
      int v;
      cin >> v;
      G[u].emplace_back(v);
      _G[v].emplace_back(u);
    }
  }
  for (int u = 1; u <= n; u++)
    if (!vis[u]) dfs1(u);
  int scc = 1;
  memset(ID, -1, sizeof ID);
  for (--idx; idx >= 0; idx--) {
    int u = tem[idx];
    if (ID[u] == -1) dfs2(u, scc), scc++;
  }
  for (int u = 1; u <= n; u++) _G[u].clear();
  for (int u = 1; u <= n; u++)
    for (int v : G[u])
      if (ID[u] != ID[v]) _G[ID[u]].emplace_back(ID[v]);
  bool flag = true;
  memset(vis, false, sizeof vis);
  for (int i = 1; i <= k; i++)
    if (!vis[need[i]]) flag &= dfs3(ID[need[i]]);
  if (!flag)
    cout << -1 << '\n';
  else {
    memset(vis, false, sizeof vis);
    idx = 0;
    for (int i = 1; i <= k; i++) {
      int u = need[i];
      if (!vis[u]) dfs1(u);
    }
    cout << idx << '\n';
    for (int i = 0; i < idx; i++) {
      if (i != 0) cout << " ";
      cout << tem[i];
    }
    cout << '\n';
  }
  return 0;
}
