#include<cstdio>
#include<iostream>
using namespace std;
int m,n;
int a[1999][1999];
int t;
int root;
int dfn[999];
int low[999];
int flag[9999];
int dfs(int x,int f)
{
int c=0;
dfn[x]=++t;
low[x]=t;
for(int i=1;i<=n;i++)
{
if(a[x][i]==1)
{
if(!dfn[i]){
c++;
dfs(i,x);
low[x]=min(low[i],low[x]);
if(low[i]>=dfn[x]&&x!=root)
flag[x]=1;
if(x==root&&c==2) flag[x]=1;
}
else if(f!=i) low[x]=min(low[x],dfn[i]);
}
}
}
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=m;i++){
int x,y;
scanf("%d%d",&x,&y);
a[x][y]=1;
a[y][x]=1;
}
root=1;
dfs(root,1);
for(int i=1;i<=n;i++)
if(flag[i]) printf("%d",i);
}