#include <bits/stdc++.h> // {{{
// clang-format off
#pragma GCC optimize "O3,omit-frame-pointer,inline"
#pragma GCC target "tune=native"
#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(n) ((ll)(1e##n))
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define USE1(T) template<typename T>inline
#define USE2(T, U) template<typename T,typename U>inline
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)

template<typename T>using duo=std::pair<T,T>;
template<typename T>using vec=std::vector<T>;
using ll=long long;
using pii=duo<int>;
USE2(T,U)bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE2(T,U)bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE1(T=int)T in(){T x;std::cin>>x;return x;}
USE1(T=int)vec<T>in(int n){vec<T>v;v.reserve(n);rep(i,n)v.pb(in<T>());return v;}
USE1(T=int)vec<T>in(int n,T a){vec<T>v;v.reserve(n);rep(i,n)v.pb(in<T>()+a);return v;}
USE1(T)vec<std::pair<T,int>>enume(const vec<T>&x,int s=0){int N=x.size();vec<std::pair<T,int>>v;v.reserve(N);rep(i,N)v.pb(x[i],s+i);return v;}
USE1(T)vec<T>ndvec(T v,int n){return vec<T>(n,v);}
USE2(T,...Ts)auto ndvec(T v,int n,Ts...ns)->vec<decltype(ndvec(v,ns...))>{return ndvec(ndvec(v,ns...),n);}
USE1(T)void pr(T x){std::cout<<x<<'\n';}
USE2(T,...Ts)void pr(T x,Ts...xs){std::cout<<x<<' ';pr(xs...);}
USE1(T=int)T rd(){T x=0,m=0,k;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||'9'<k)break;x=x*10+k-'0';}return x;}
USE1(T=int)void wr(T x,char c='\n'){int s=0,m=0;char b[32];if(x<0)m=1,x=-x;for(;x;x/=10)b[s++]=x%10;if(!s)b[s++]=0;if(m)mypc('-');for(;s--;)mypc(b[s]+'0');mypc(c);}
// clang-format on
// }}}
struct IoSetup { // {{{
  IoSetup() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.precision(10);
    std::cerr.precision(10);
  }
} iosetup; //}}}
#include <vector>
namespace copr {
template <typename T>
struct Edge {
  using value_type = T;
  int from, to;
  value_type val;
  Edge(int from, int to, value_type val = 1) : from(from), to(to), val(val) {}
  bool operator<(const Edge& rhs) const {
    if (val != rhs.val) return val < rhs.val;
    if (from != rhs.from) return from < rhs.from;
    return to < rhs.to;
  }
  bool operator>(const Edge& rhs) const { return rhs < *this; }
};
template <typename T>
using Edges = std::vector<Edge<T>>;
} // namespace copr
namespace copr {
template <typename CostType>
struct Graph {
  using value_type = std::vector<Edges<CostType>>;
  const int V;
  value_type G;
  Graph(int V) : V(V), G(V) {}
  void add_edge(int from, int to, CostType cost, bool undirected = true) {
    G[from].emplace_back(from, to, cost);
    if (undirected) G[to].emplace_back(to, from, cost);
  }
};
} // namespace copr

#include <algorithm>
namespace copr {
template <typename GraphType>
struct Lowlink {
  const GraphType& graph;
  std::vector<int> ord, low, art;
  Edges<int> bridges;
  int k = 0;

  Lowlink(const GraphType& graph) : graph(graph), ord(graph.V, -1), low(graph.V), art(graph.V) {
    for (int u = 0; u < graph.V; ++u) {
      if (ord[u] >= 0) continue;
      dfs(u);
    }
  }
  bool is_bridge(int u, int v) const {
    if (ord[u] > ord[v]) std::swap(u, v);
    return ord[u] < low[v];
  }
  bool is_articulation(int u) { return art[u]; }
  void dfs(int u, int p = -1) {
    ord[u] = low[u] = k;
    ++k;
    int deg = 0;
    for (auto&& e : graph.G[u]) {
      int v = e.to;
      if (v == p) continue;
      if (ord[v] >= 0) {
        low[u] = std::min(low[u], ord[v]);
      } else {
        dfs(v, u);
        deg++;
        low[u] = std::min(low[u], low[v]);
        if (p >= 0 && ord[u] <= low[v]) art[u] = 1;
        if (ord[u] < low[v]) bridges.emplace_back(u, v);
      }
    }
    if (p == -1 && deg > 1) art[u] = 1;
  }
};
template <typename T>
Lowlink<T> lowlink(const T& graph) {
  return Lowlink<T>(graph);
}
} // namespace copr
using namespace std;
const int inf = 1001001001;
const ll infl = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

signed main() { //
  int V = in(), E = in();
  copr::Graph<int> G(V);
  rep(i, E) {
    int s = in(), t = in();
    G.add_edge(s, t, 1, true);
  }
  auto low = copr::lowlink(G);
  rep(i, V) {
    if (low.is_articulation(i)) { pr(i); }
  }

  return 0;
}

Measured memory_bytes: 5596