#include <bits/stdc++.h>
#define fst ios_base::sync_with_stdio(0); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI acos(-1.0)
#define rd freopen("ip.txt","r",stdin)
#define wr freopen("op.txt", "w", stdout)
#define wis(x) cerr << #x << " is " << x << endl;
#define mem(array,int) memset(array,int,sizeof(array))
#define lld long long int
#define nl cout<<endl;
#define mx 200009
#define MOD 1000000007
#define pii pair<int,int>
#define INF 1000009
using namespace std;
//const int mx = 1e5+5;
vector<int>G[mx],city;
int color[mx] ,vis[mx],par[mx],dist[mx],N,E;
void DFS(int n){
color[n] = 1;
vis[n]++;
for (int i=0; i<G[n].size(); i++) {
int x = G[n][i];
if (color[x] == 0) {
DFS(x);
}
}
// color[n] = 2;
//cout<<n<<" ";
}
int main()
{
// rd;
//wr;
fst;
while(cin>>N>>E)
{
for(int i=0;i<E;i++)
{
int u,v;
cin >> u >> v;
G[u].push_back(v);
// G[v].push_back(u);
}
for (int i = 1; i <= N; ++i)
{
DFS(i);
mem(color,0);
// nl;
}
// int lim = sizeof(vis)/sizeof(*vis);
for (int i = 1; i <= N ; ++i)
{
if (vis[i] == N)
{
city.push_back(i);
}
// printf("%d == %d\n",i,vis[i] );
}
int lim = city.size();
//cout<<lim<<endl;
printf("%d\n",lim );
for (int i = 0; i < lim; ++i)
{
// cout<<city[i]<<" ";
printf("%d ",city[i] );
}
nl;
mem(vis,0);
mem(color,0);
for (int i = 0; i < mx; ++i)
{
G[i].clear();
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgZnN0IGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oMCk7IGlvczo6c3luY193aXRoX3N0ZGlvKDApOyBjaW4udGllKDApOyBjb3V0LnRpZSgwKTsKI2RlZmluZSBQSSBhY29zKC0xLjApCiNkZWZpbmUgcmQgZnJlb3BlbigiaXAudHh0IiwiciIsc3RkaW4pCiNkZWZpbmUgd3IgZnJlb3Blbigib3AudHh0IiwgInciLCBzdGRvdXQpCiNkZWZpbmUgd2lzKHgpIGNlcnIgPDwgI3ggPDwgIiBpcyAiIDw8IHggPDwgZW5kbDsKI2RlZmluZSBtZW0oYXJyYXksaW50KSBtZW1zZXQoYXJyYXksaW50LHNpemVvZihhcnJheSkpCiNkZWZpbmUgbGxkIGxvbmcgbG9uZyBpbnQKI2RlZmluZSBubCBjb3V0PDxlbmRsOwojZGVmaW5lIG14IDIwMDAwOQojZGVmaW5lIE1PRCAxMDAwMDAwMDA3CiNkZWZpbmUgcGlpIHBhaXI8aW50LGludD4KI2RlZmluZSBJTkYgMTAwMDAwOQp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKLy9jb25zdCBpbnQgbXggPSAxZTUrNTsKCgoKCnZlY3RvcjxpbnQ+R1tteF0sY2l0eTsKCmludCBjb2xvcltteF0gLHZpc1tteF0scGFyW214XSxkaXN0W214XSxOLEU7CgoKCnZvaWQgREZTKGludCBuKXsKCgogICAgY29sb3Jbbl0gPSAxOwogICAgdmlzW25dKys7CgogICAgZm9yIChpbnQgaT0wOyBpPEdbbl0uc2l6ZSgpOyBpKyspIHsKICAgICAgICBpbnQgeCA9IEdbbl1baV07CgogICAgICAgIGlmIChjb2xvclt4XSA9PSAwKSB7CiAgICAgICAgICAgIERGUyh4KTsKICAgICAgICB9CiAgICB9CiAgICAvLyBjb2xvcltuXSA9IDI7CiAgICAvL2NvdXQ8PG48PCIgIjsKCn0KCgoKaW50IG1haW4oKQp7CgogIC8vICByZDsKICAgIC8vd3I7CiAgICBmc3Q7CgogICAgCgogICAgd2hpbGUoY2luPj5OPj5FKQogICAgewogICAgICAgIAogICAgICAgIGZvcihpbnQgaT0wO2k8RTtpKyspCiAgICAgICAgewogICAgICAgICAgICBpbnQgdSx2OwogICAgICAgICAgICBjaW4gPj4gdSA+PiB2OwogICAgICAgICAgICBHW3VdLnB1c2hfYmFjayh2KTsKICAgICAgICAgICAvLyBHW3ZdLnB1c2hfYmFjayh1KTsKICAgICAgICB9CiAgICAgICAgCiAgICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gTjsgKytpKQogICAgICAgIHsKICAgICAgICAgICAgREZTKGkpOwogICAgICAgICAgICBtZW0oY29sb3IsMCk7CiAgICAgICAgICAgLy8gbmw7CiAgICAgICAgfQoKICAgICAgIC8vIGludCBsaW0gPSBzaXplb2YodmlzKS9zaXplb2YoKnZpcyk7CiAgICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gTiA7ICsraSkKICAgICAgICB7CiAgICAgICAgICAgIGlmICh2aXNbaV0gPT0gTikKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgY2l0eS5wdXNoX2JhY2soaSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIC8vICBwcmludGYoIiVkID09ICVkXG4iLGksdmlzW2ldICk7CiAgICAgICAgfQogICAgICAgIGludCBsaW0gPSBjaXR5LnNpemUoKTsKICAgICAgICAvL2NvdXQ8PGxpbTw8ZW5kbDsKCiAgICAgICAgcHJpbnRmKCIlZFxuIixsaW0gKTsKICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxpbTsgKytpKQogICAgICAgIHsKICAgICAgICAgICAvLyBjb3V0PDxjaXR5W2ldPDwiICI7CiAgICAgICAgICAgIHByaW50ZigiJWQgIixjaXR5W2ldICk7CiAgICAgICAgfQogICAgICAgIG5sOwogICAgICAgIG1lbSh2aXMsMCk7CiAgICAgICAgbWVtKGNvbG9yLDApOwogICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbXg7ICsraSkKICAgICAgICB7CiAgICAgICAgICAgIEdbaV0uY2xlYXIoKTsKICAgICAgICB9CgoKICAgIH0KCiAgICAKICAgIHJldHVybiAwOwp9