func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5, maxm = 1e5 + 5;   int first[maxn], n, k;   struct edge {     int to;     int next;   } E[maxm];   int vis[maxn];   int order[maxn], p;   int a[maxn];   bool dfs(int u) {     vis[u] = -1;     for (int e = first[u]; e != -1; e = E[e].next) {       int v = E[e].to;       if (vis[v] == -1)         return false;       else if (!vis[v] && !dfs(v))         return false;     }     vis[u] = 1;     order[p++] = u;     return true;   }   bool topo() {     p = 0;     memset(vis, 0, sizeof(vis));     for (int i = 0; i < k; i++)       if (!vis[a[i]] && !dfs(a[i])) return false;     return true;   }   int main() {     while (scanf( %d%d , &n, &k) != EOF) {       memset(first, -1, sizeof(first));       for (int i = 0; i < k; i++) scanf( %d , &a[i]);       int t, x, ecnt = 0;       for (int i = 1; i <= n; i++) {         scanf( %d , &t);         for (int j = 0; j < t; j++) {           scanf( %d , &x);           E[ecnt].to = x;           E[ecnt].next = first[i];           first[i] = ecnt++;         }       }       if (!topo())         cout <<  -1 n ;       else {         cout << p <<   n ;         for (int i = 0; i < p; i++) cout << order[i] <<    n [i == p - 1];       }     }     return 0;   }   