#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > G;
vector<int> mark;
vector<int> ans;
bool flag = true;
void top_sort(int v) {
  mark[v] = 1;
  for (int u : G[v]) {
    if (mark[u] == 0) top_sort(u);
    if (mark[u] == 1) {
      flag = false;
      return;
    }
  }
  ans.push_back(v);
  mark[v] = 2;
}
int main() {
  int n, k;
  cin >> n >> k;
  G.resize(n);
  mark.assign(n, 0);
  vector<int> importance(n, 0);
  for (int i = 0; i < k; i++) {
    int num;
    cin >> num;
    importance[num - 1] = 1;
  }
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    for (int j = 0; j < t; j++) {
      int num;
      cin >> num;
      G[i].push_back(num - 1);
    }
  }
  for (int i = 0; i < n; i++) {
    if (mark[i] == 0 && importance[i] == 1) top_sort(i);
    if (!flag) break;
  }
  if (!flag)
    cout << -1;
  else {
    cout << ans.size() << '\n';
    for (int i = 0; i < ans.size(); i++) cout << ans[i] + 1 << ' ';
  }
  return 0;
}
