#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 9;
int n, m, k, x, a[N], c[N];
vector<int> v[N], ans;
void dfs(int i) {
  c[i] = 1;
  for (int j = 0; j < v[i].size(); ++j) {
    int u = v[i][j];
    if (!c[u])
      dfs(u);
    else if (c[u] == 1) {
      cout << -1 << endl;
      exit(0);
    }
  }
  c[i] = 2;
  ans.push_back(i);
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < k; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) {
    cin >> m;
    while (m--) cin >> x, v[i].push_back(x);
  }
  for (int i = 0; i < k; ++i)
    if (!c[a[i]]) dfs(a[i]);
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); ++i) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
