rt
#include<bits/stdc++.h>
using namespace std;
vector<int> v;
int n,m;
struct Edge
{
int to,next;
};
Edge edge[2000005];
int cnt,head[200004];
void add(int fr,int to)
{
cnt++;
edge[cnt].to=to;
edge[cnt].next=head[fr];
head[fr]=cnt;
}
int low[200004],deep[200004];
void dfs1(int x,int fa)
{
deep[x]=low[x]=deep[fa]+1;
int js=0;
for(int i=head[x];i;i=edge[i].next)
{
int y=edge[i].to;
if(y==fa)
{
continue;
}
if(deep[y]==0)
{
dfs1(y,x);
low[x]=min(low[x],low[y]);
if(low[y]>=deep[x]&&fa!=0)
{
v.push_back(x);
}
}
else
{
low[x]=min(low[x],deep[y]);
}
}
if(fa==0&&js>=2)
{
v.push_back(x);
}
//cout<<x<<" "<<deep[x]<<" "<<low[x]<<"\n";
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n>>m;
for(int i=1;i<=m;i++)
{
int x,y;
cin>>x>>y;
add(x,y);
add(y,x);
}
for(int i=1;i<=n;i++)
{
if(deep[i]==0)
{
dfs1(i,0);
}
}
//cout<<v.size()<<"\n";
sort(v.begin(),v.end());
v.erase(unique(v.begin(),v.end()),v.end());
cout<<v.size()<<"\n";
for(int i=0;i<v.size();i++)
{
cout<<v[i]<<" ";
}
return 0;
}