#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
bool compare(T x, U y) {
  return (abs(x - y) <= 1e-9);
}
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
vector<int> adj[N], rev_adj[N];
set<int> imp;
vector<int> vis(N);
set<pair<int, int> > st;
vector<int> indegree(N);
set<int> kss;
void dfs(int s) {
  st.insert({indegree[s], s});
  kss.insert(s);
  for (auto &x : rev_adj[s]) {
    if (!vis[x]) {
      vis[x] = 1;
      dfs(x);
    }
  }
}
void solve() {
  int n, k;
  cin >> n >> k;
  while (k--) {
    int x;
    cin >> x;
    imp.insert(x);
  }
  for (int i = 1; i <= n; i++) {
    int t;
    cin >> t;
    while (t--) {
      int x;
      cin >> x;
      adj[x].push_back(i);
      rev_adj[i].push_back(x);
      indegree[i]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (imp.count(i)) {
      vis[i] = 1;
      dfs(i);
    }
  }
  vector<int> srt;
  while (!st.empty()) {
    int src = (st.begin())->second;
    if ((st.begin())->first != 0) {
      cout << -1;
      return;
    }
    srt.push_back(src);
    st.erase(st.begin());
    for (auto &x : adj[src]) {
      if (kss.count(x)) {
        st.erase({indegree[x], x});
        indegree[x]--;
        st.insert({indegree[x], x});
      }
    }
  }
  for (int i = 0; i < (int)srt.size(); i++) {
    if (imp.count(srt[i])) imp.erase(srt[i]);
    if (imp.empty()) {
      cout << i + 1 << "\n";
      for (int j = 0; j <= i; j++) cout << srt[j] << " ";
      return;
    }
  }
  cout << -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
}
