#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<vector<int>> dir(N), inv(N), ndir(N);
vector<int> mn;
int vis[N];
int deg[N];
bool dfs(int nd) {
  vis[nd] = 1;
  for (auto ch : inv[nd]) {
    if (vis[ch] == 1) return false;
    if (!vis[ch] && !dfs(ch)) return false;
  }
  vis[nd] = 2;
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k, x;
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    cin >> x;
    mn.emplace_back(x);
  }
  for (int i = 1; i <= n; i++) {
    int t;
    cin >> t;
    while (t--) {
      cin >> x;
      dir[x].emplace_back(i);
      inv[i].emplace_back(x);
    }
  }
  for (auto a : mn) {
    if (vis[a]) continue;
    if (!dfs(a)) {
      cout << -1;
      return 0;
    }
  }
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) continue;
    for (auto ch : dir[i])
      if (vis[ch]) ndir[i].emplace_back(ch), deg[ch]++;
  }
  for (int i = 1; i <= n; i++)
    if (!vis[i])
      continue;
    else if (!deg[i])
      q.push(i);
  vector<int> ans;
  while (q.size()) {
    int nd = q.front();
    ans.push_back(nd);
    q.pop();
    for (auto ch : ndir[nd]) {
      deg[ch]--;
      if (vis[ch] && !deg[ch]) q.push(ch);
    }
  }
  cout << ans.size() << endl;
  for (auto a : ans) cout << a << " ";
  return 0;
}
