#include <bits/stdc++.h>
using namespace std;
vector<int> g[100002];
vector<int> answ;
int n, k;
int markness[100002];
bool mark[100002];
bool mark2[100002];
int deg[100002];
int h;
int Q = 0;
bool z = true;
void dfs(int x) {
  if (!z) return;
  if (mark[x] && !mark2[x]) {
    z = false;
    return;
  }
  if (mark2[x]) return;
  mark[x] = true;
  for (int i = 0; i < (int)g[x].size(); i++) {
    int v = g[x][i];
    dfs(v);
  }
  mark2[x] = true;
  if (markness[x] == -1) Q++;
  answ.push_back(x);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < k; i++) {
    scanf("%d", &h);
    markness[h] = -1;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &deg[i]);
    for (int j = 0; j < deg[i]; j++) {
      int v;
      scanf("%d", &v);
      g[i].push_back(v);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (markness[i] == -1) dfs(i);
  }
  if (!z || Q != k) {
    cout << -1 << endl;
    return 0;
  }
  printf("%d\n", (int)answ.size());
  for (int i = 0; i < (int)answ.size(); i++) printf("%d ", answ[i]);
  cout << endl;
  return 0;
}
