/*
??¢??????
lowlink
*/
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
const int MAX_V=100000;
vector<int> G[MAX_V];
int ord[MAX_V],low[MAX_V];
int I;
int sum[MAX_V];
vector<int> arts;
void dfs(int v,int p){
	ord[v]=++I;
	low[v]=ord[v];
	sum[v]=1;
	int mx=0,c=0;
	for(int u:G[v]) if(u!=p){
		if(ord[u]) chmin(low[v],ord[u]);
		else{
			dfs(u,v);
			c++;
			sum[v]+=sum[u];
			chmin(low[v],low[u]);
			chmax(mx,low[u]);
		}
	}
	if(p<0){
		if(c>1) arts.pb(v);
	}else{
//		cout<<"v="<<v<<"  mx="<<mx<<endl;
		if(ord[v]<=mx) arts.pb(v);
	}
}
void arti(int N){
	rep(i,N) if(ord[i]==0) dfs(i,-1);
}
int main(){
	int N,M;
	cin>>N>>M;
	rep(i,M){
		int a,b;
		cin>>a>>b;
		G[a].pb(b);G[b].pb(a);
	}
	arti(N);
	sort(all(arts));
	for(int a:arts) cout<<a<<endl;
}