#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:64000000")
const int infi = 1e9 + 7;
const long long infl = 1e18 + 7;
vector<vector<int> > g;
int used[100500];
int imp[100500];
int flag = 1;
vector<int> ans;
void dfs(int v) {
  if (used[v] == 1) flag = 0;
  if (used[v]) return;
  used[v] = 1;
  for (int i = 0; i < ((int)g[v].size()); ++i) dfs(g[v][i]);
  used[v] = 2;
  ans.push_back(v);
  return;
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < (k); ++i) {
    int a;
    cin >> a;
    imp[a - 1] = 1;
  }
  g.resize(n);
  for (int i = 0; i < (n); ++i) {
    int m;
    cin >> m;
    for (int j = 0; j < (m); ++j) {
      int to;
      cin >> to;
      g[i].push_back(to - 1);
    }
  }
  for (int i = 0; i < (n); ++i) {
    if (imp[i]) dfs(i);
  }
  if (!flag) {
    cout << -1;
    return 0;
  }
  cout << (int)ans.size() << '\n';
  for (int i = 0; i < ((int)ans.size()); ++i) cout << ans[i] + 1 << ' ';
  return 0;
}
