#include <bits/stdc++.h>
bool dfs(int v, const std::vector<std::vector<int> > &graph,
         std::vector<char> &color, std::vector<int> &answer) {
  color[v] = 1;
  for (int c : graph[v]) {
    if (color[c] == 0) {
      if (dfs(c, graph, color, answer)) {
        return true;
      }
    } else {
      if (color[c] == 1) {
        return true;
      }
    }
  }
  color[v] = 2;
  answer.push_back(v);
  return false;
}
int main() {
  int n, k;
  std::cin >> n >> k;
  std::vector<int> requeried(k);
  for (int i = 0; i < k; i++) {
    int x;
    std::cin >> x;
    requeried[i] = x - 1;
  }
  std::vector<std::vector<int> > graph(n);
  for (int i = 0; i < n; i++) {
    int m, x;
    std::cin >> m;
    for (int j = 0; j < m; j++) {
      std::cin >> x;
      graph[i].push_back(x - 1);
    }
  }
  std::vector<char> color(n, 0);
  std::vector<int> answer;
  for (int i = 0; i < requeried.size(); i++) {
    if ((color[requeried[i]] == 0 && dfs(requeried[i], graph, color, answer)) ||
        color[requeried[i]] == 1) {
      std::cout << -1;
      return 0;
    }
  }
  std::cout << answer.size() << std::endl;
  for (int i = 0; i < answer.size(); i++) {
    std::cout << answer[i] + 1 << ' ';
  }
}
