#include <bits/stdc++.h>
using namespace std;
vector<long long int> adj[100010];
vector<long long int> inv[100010];
bool visitado[100010];
long long int marca[100010];
vector<long long int> cursos;
long long int cant, n, prof, k;
stack<long long int> pila;
stack<long long int> rpta;
void dfs(long long int nodo) {
  prof++;
  visitado[nodo] = true;
  long long int len = inv[nodo].size();
  for (long long int i = (long long int)(0); i < (long long int)(len); i++) {
    if (!visitado[inv[nodo][i]]) dfs(inv[nodo][i]);
  }
  marca[nodo] = prof;
}
bool toposort(long long int nodo) {
  bool rpta = true;
  visitado[nodo] = true;
  long long int len = adj[nodo].size();
  for (long long int i = (long long int)(0); i < (long long int)(len); i++) {
    if (!visitado[adj[nodo][i]]) rpta &= toposort(adj[nodo][i]);
  }
  if (marca[nodo] != 1) rpta &= false;
  pila.push(nodo);
  return rpta;
}
bool verificar() {
  for (long long int i = (long long int)(0); i < (long long int)(n); i++) {
    if (!visitado[i + 1]) toposort(i + 1);
  }
  for (long long int i = (long long int)(0); i < (long long int)(100010); i++)
    visitado[i] = false;
  long long int aux2 = 0;
  while (!pila.empty()) {
    long long int nodo = pila.top();
    pila.pop();
    if (!visitado[nodo]) {
      prof = 0;
      dfs(nodo);
      aux2++;
    }
  }
  bool aux = true;
  for (long long int i = (long long int)(0); i < (long long int)(100010); i++)
    visitado[i] = false;
  for (long long int i = (long long int)(0); i < (long long int)(k); i++)
    if (marca[cursos[i]] != 1) aux = false;
  return aux;
}
void cambio() {
  cant = 0;
  while (!pila.empty()) {
    long long int cabeza = pila.top();
    rpta.push(cabeza);
    pila.pop();
    cant++;
  }
}
void imp() {
  bool primero = true;
  cout << cant << endl;
  while (!rpta.empty()) {
    if (!primero) printf(" ");
    primero = false;
    printf("%lld", rpta.top());
    rpta.pop();
  }
  cout << endl;
}
int main() {
  for (long long int i = (long long int)(0); i < (long long int)(100010); i++)
    visitado[i] = false;
  scanf("%lld %lld", &n, &k);
  cursos.resize(k);
  for (long long int i = (long long int)(0); i < (long long int)(k); i++)
    scanf("%lld", &cursos[i]);
  long long int cant = 0, req = 0;
  for (long long int i = (long long int)(0); i < (long long int)(n); i++) {
    scanf("%lld", &cant);
    for (long long int j = (long long int)(0); j < (long long int)(cant); j++) {
      scanf("%lld", &req);
      adj[i + 1].push_back(req);
      inv[req].push_back(i + 1);
    }
  }
  verificar();
  bool ans = true;
  for (long long int i = (long long int)(0); i < (long long int)(k); i++) {
    if (!visitado[cursos[i]]) ans &= toposort(cursos[i]);
  }
  if (!ans) puts("-1"), exit(0);
  cambio();
  imp();
  return 0;
}
