MAX = 100001
class Node
  attr_accessor :pre, :parent, :child, :lowest, :visited
  def initialize
    @pre = MAX
    @parent = 0
    @child = []
    @lowest = MAX
    @visited = false
  end
end

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

#   g[c].child.each{|j|
#     if g[j].visited == false
#       g[j].parent = c
#       dfs(j, c, 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

def dfs(c, p, g)
  stack = []
  g[c].pre = g[c].lowest = $t
  g[c].visited = true
  stack << c

  while stack.size > 0
    n = stack[-1]
    j = -1
    g[n].child.each{|i|
      if g[i].visited == false
        j = i
        $t += 1
        g[i].pre = g[i].lowest = $t
        g[i].parent = n
        g[i].visited = true
        g[n].lowest = g[i].lowest if g[i].lowest < g[n].lowest
        stack << j
        break
      elsif i != g[n].parent
        g[n].lowest = g[i].pre if g[i].pre < g[n].lowest
      end
    }
    if j == -1
      stack.pop
      g[n].child.each{|i|
        next if i == stack[-1]
        g[n].lowest = g[i].lowest if g[i].lowest < g[n].lowest
      }
    end
  end
end

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

dfs(0, -1, graph)

ap = []
np = 0
1.upto(v-1){|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.uniq.sort.each{|i|
  puts i
}