func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k;   vector<bool> is_important;   vector<vector<int> > graph;   vector<int> used;   vector<int> res;   bool dfs(int v) {     used[v] = 1;     bool f_p = is_important[v];     for (int u : graph[v]) {       if (used[u] == 0) {         f_p = dfs(u) || f_p;       } else if (used[u] == 1) {         cout << -1 << endl;         exit(0);       }     }     used[v] = 2;     res.push_back(v);     return f_p;   }   int main() {     cin >> n >> k;     is_important.assign(n, false);     used.assign(n, 0);     graph.resize(n);     for (int i = 0; i < k; i++) {       int x;       cin >> x;       is_important[x - 1] = true;     }     for (int i = 0; i < n; i++) {       int m;       cin >> m;       for (int j = 0; j < m; j++) {         int v;         cin >> v;         graph[i].push_back(v - 1);       }     }     for (int i = 0; i < n; i++) {       if (is_important[i] && used[i] == 0) dfs(i);     }     cout << res.size() << endl;     for (int i = 0; i < res.size(); i++) {       cout << res[i] + 1 <<    ;     }     return 0;   }   