#include <bits/stdc++.h>
using namespace std;
int n, k, m = 0;
int a[100010], vis[100010], topo[100010];
vector<int> G[100010], H[100010];
void Dfs(int u) {
  vis[u] = 1;
  for (auto &v : H[u])
    if (!vis[v]) Dfs(v);
}
bool dfs(int u) {
  vis[u] = -1;
  for (auto &v : G[u]) {
    if (vis[v] < 0)
      return 0;
    else if (vis[v] == 1 && !dfs(v))
      return false;
  }
  vis[u] = 2;
  topo[m++] = u;
  return true;
}
bool toposort() {
  for (int u = 1; u <= n; ++u)
    if (vis[u] == 1 && !dfs(u)) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  int i, u, v, t;
  cin >> n >> k;
  for (i = 0; i < k; ++i) cin >> a[i];
  for (u = 1; u <= n; ++u) {
    cin >> t;
    for (i = 0; i < t; ++i) {
      cin >> v;
      H[u].push_back(v);
      G[v].push_back(u);
    }
  }
  for (i = 0; i < k; ++i) Dfs(a[i]);
  if (toposort()) {
    cout << m << endl;
    for (i = m - 1; i >= 0; --i) cout << topo[i] << ' ';
    cout << endl;
  } else
    cout << -1 << endl;
  return 0;
}
