class Node
  attr_accessor :pre, :parent, :child, :lowest, :visited
  def initialize
    @pre = -1
    @parent = -1
    @child = []
    @lowest = -1
    @visited = false
  end
end

def dfs(c, p, t, g)
  g[c].pre = g[c].lowest = t
  t += 1
  g[c].visited = true

  g[c].child.size.times{|i|
    j = g[c].child[i]
    if g[j].visited == false
      g[j].parent = c
      dfs(j, c, t, g)
      g[c].lowest = g[j].lowest if g[j].lowest < g[c].lowest
    elsif j != p
      g[c].lowest = g[j].pre if g[j].pre < g[c].lowest
    end
  }
end

v, e = gets.split.map(&:to_i)
exit if v < 2
graph = Array.new(v){Node.new}
e.times{
  s, t = gets.split.map(&:to_i)
  graph[s].child << t
  graph[t].child << s
}

t = 1
dfs(0, -1, t, graph)

p graph

ap = []
np = 0
v.times{|i|
  p = graph[i].parent
  if p == 0
    np += 1
  elsif graph[p].pre <= graph[i].lowest
    ap << p
  end
}
ap << 0 if np > 1
ap.sort.each{|i|
  puts i
}