#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

vector<int> to[100007];
vector<int> color(100007);
vector<int> prenum(100007);
vector<int> parent(100007);
vector<int> lowest(100007);
int now = 0;

void dfs(int u, int b=-1){
    prenum[u] = now;
    now++;
    color[u] = 1;
    parent[u] = b;
    lowest[u] = prenum[u];
    if(to[u].size() != 0){
        rep(i, to[u].size()){
            int v = to[u][i];
            if(color[v] == 0){
                dfs(v, u);
                lowest[u] = min(lowest[u], lowest[v]);
            } else if(v != b){
                lowest[u] = min(lowest[u], prenum[v]);
            }
        }
    }
    return;
}

int main() {
    int V, E; cin >> V >> E;
    rep(i, E){
        int s, t; cin >> s >> t;
        to[s].push_back(t);
        to[t].push_back(s);
    }
    dfs(0);

    set<int> ans;
    int rc = 0;
    for (int i = 1; i < V; i++){
        int p = parent[i];
        if(p == 0){
            rc++;
        } else if(prenum[p] <= lowest[i]) {
            ans.insert(p);
        }
    }
    if(rc > 1){
        ans.insert(0);
    }
    if(!ans.empty()){
        for(auto x : ans){
            cout << x << endl;
        }
    }

    return 0;
}
