#include <iostream>
using namespace std;
int
n, k, father[101], child[101];
void
__read__()
{
cin >> n >> k;
for( int i = 1; i <= k; i++ )
{
int x, y;
cin >> x >> y;
father[y] = x;
}
}
void
__see__()
{
for( int i = 1; i <= n; i++ )
if( !father[i] )
cout << i << endl;
for( int i = 1; i <= n; i++ )
child[father[i]]++;
int c = 0, chmax = 0;
for( int i = 1; i <= n; i++ )
if( child[i] > c )
{
c = child[i];
chmax = i;
}
cout << chmax << endl;
for( int i = 1; i <= n; i++ )
if( father[i] == chmax )
cout << i << " ";
cout << endl;
}
int
main()
{
__read__();
__see__();
return 0;
}