#include <bits/stdc++.h>   using namespace std;   vector<int> g[1000010];   int n, k;   bool r[1000010];   int s[1000010];   int m[1000010];   int main() {     scanf( %d %d , &n, &k);     for (int i = 0; i < k; i++) {       int x, y;       scanf( %d %d , &x, &y);       g[x].push_back(y);     }     int v = 0;     for (int i = 1; i <= n; i++) {       if (r[i]) continue;       s[v++] = i;       r[i] = true;       for (int j = 0; j < (int)g[i].size(); j++) r[g[i][j]] = true;     }     int sz = 0;     for (int i = 1; i <= n; i++) r[i] = false;     for (int i = v - 1; i >= 0; i--) {       if (!r[s[i]]) {         m[sz++] = s[i];         for (int j = 0; j < (int)g[s[i]].size(); j++) r[g[s[i]][j]] = true;       }     }     printf( %d n , sz);     for (int i = 0; i < sz; i++) printf( %d  , m[i]);     printf(  n );     return 0;   }   