#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
vector<int> ans;
vector<int> c;
bool dfs(int v) {
  c[v] = 1;
  for (int i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    if (c[to] == 1) {
      cout << -1;
      return true;
    }
    if (c[to] == 0)
      if (dfs(to)) return true;
  }
  c[v] = 2;
  ans.push_back(v);
  return false;
}
int main() {
  int n, k;
  cin >> n >> k;
  c.resize(n, 0);
  g.resize(n);
  vector<int> gl(k);
  int x;
  for (int i = 0; i < k; ++i) cin >> gl[i], gl[i]--;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    g[i].resize(x);
    for (int j = 0; j < x; ++j) cin >> g[i][j], g[i][j]--;
  }
  for (int i = 0; i < k; ++i)
    if (c[gl[i]] == 0)
      if (dfs(gl[i])) return 0;
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); ++i) cout << ans[i] + 1 << ' ';
  return 0;
}
