#include <bits/stdc++.h>
using namespace std;
void dfs(int cur, vector<bool>& visited, vector<vector<int>>& adj) {
  if (visited[cur]) return;
  visited[cur] = true;
  for (int nxt : adj[cur]) {
    dfs(nxt, visited, adj);
  }
}
vector<int> top(vector<vector<int>>& adj, vector<bool>& visited, int k) {
  int size = 0;
  vector<int> res(k);
  vector<int> incoming(adj.size());
  for (vector<int>& al : adj) {
    for (int incom : al) {
      incoming[incom]++;
    }
  }
  for (int i = 0; i < incoming.size(); i++) {
    if (incoming[i] == 0 && visited[i]) {
      res[size++] = i;
    }
  }
  for (int i = 0; i < size; i++) {
    int cur = res[i];
    for (int nxt : adj[cur]) {
      if (--incoming[nxt] == 0 && visited[nxt]) {
        res[size++] = nxt;
      }
    }
  }
  if (size != k) return vector<int>(1, -1);
  return res;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> need(k);
  for (int i = 0; i < (int)need.size(); i++) {
    int t;
    cin >> t;
    need[i] = t - 1;
  }
  vector<vector<int>> adj(n);
  vector<vector<int>> topadj(n);
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    for (int j = 0; j < num; j++) {
      int o;
      cin >> o;
      o--;
      adj[i].push_back(o);
      topadj[o].push_back(i);
    }
  }
  int iter = 0;
  vector<bool> visited(n, false);
  vector<int> res;
  for (int start : need) {
    dfs(start, visited, adj);
  }
  int count = 0;
  for (bool b : visited)
    if (b) count++;
  vector<int> ordered = top(topadj, visited, count);
  if (ordered.size() == 1 && ordered[0] == -1) {
    cout << -1 << endl;
    return 0;
  }
  cout << ordered.size() << endl;
  for (int val : ordered) cout << val + 1 << " ";
  cout << endl;
}
