#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, k, fi[N], cnt, l;
vector<int> adj[N], imp, ans;
bool mark[N], is = true;
bool cmp(int a, int b) { return (fi[b] > fi[a]); }
void dfs(int u) {
  mark[u] = true;
  for (auto x : adj[u]) {
    if (!mark[x])
      dfs(x);
    else if (fi[x] == 0) {
      is = false;
      return;
    }
  }
  cnt++;
  fi[u] = cnt;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    int a;
    cin >> a;
    a--;
    imp.push_back(a);
  }
  for (int i = 0; i < n; i++) {
    int p, a;
    cin >> p;
    for (int j = 0; j < p; j++) {
      cin >> a;
      adj[i].push_back(a - 1);
    }
  }
  for (auto x : imp)
    if (!mark[x]) {
      dfs(x);
      if (!is) {
        cout << -1;
        return 0;
      }
    }
  for (int i = 0; i < n; i++) {
    ans.push_back(i);
    if (fi[i] > 0) l++;
  }
  sort(ans.begin(), ans.end(), cmp);
  cout << l << endl;
  for (auto x : ans)
    if (fi[x]) cout << x + 1 << " ";
  return 0;
}
