#include <bits/stdc++.h>
using namespace std;
int ct;
int cnt[200001];
int cl[200001];
bool ok[200001];
int srt[200001];
bool used[200001];
vector<int> edge[200001];
vector<int> redge[200001];
void dfs(int u) {
  used[u] = true;
  for (auto v : edge[u]) {
    if (!used[v]) dfs(v);
  }
  srt[ct--] = u;
}
void rdfs(int u) {
  used[u] = true;
  cl[u] = ct;
  cnt[ct]++;
  for (auto v : redge[u]) {
    if (!used[v]) rdfs(v);
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    int a;
    cin >> a;
    ok[--a] = 1;
  }
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    edge[i].resize(t);
    for (int j = 0; j < t; j++) {
      cin >> edge[i][j];
      edge[i][j]--;
      redge[edge[i][j]].push_back(i);
    }
  }
  ct = n - 1;
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      dfs(i);
    }
  }
  for (int i = 0; i < n; i++) used[i] = 0;
  for (int i = 0; i < n; i++) {
    if (!used[srt[i]]) {
      rdfs(srt[i]);
      ct++;
    }
  }
  vector<int> ans;
  for (int i = 0; i < n; i++) {
    if (ok[srt[i]]) {
      if (cnt[cl[srt[i]]] > 1) {
        cout << -1;
        return 0;
      }
      ans.push_back(srt[i]);
      for (auto v : edge[srt[i]]) {
        ok[v] = 1;
      }
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans.size() << "\n";
  for (auto v : ans) {
    cout << v + 1 << " ";
  }
  return 0;
}
