v, e = gets.chomp.split.map(&:to_i)

item = []
e.times do
  item << gets.chomp.split.map(&:to_i)
end

g = Array.new(v)
item.each do |elem|
  s = elem[0]
  t = elem[1]
  g[s] ||= []
  g[t] ||= []
  g[s] << t
  g[t] << s
end

g = g.map(&:uniq)

prenum = Array.new(v - 1).unshift(-1)
parent = Array.new(v, 0) 
lowest = Array.new(v, v)

path = [0]

cnt = 1

until path.empty?
  u = path[-1]
  tar_v = g[u]

  tar_v.each do |n|
    if prenum[n].nil?
      parent[n] = u
      path << n
      cnt += 1
      prenum[n] = cnt
      g[u].delete(n)
      g[n].delete(u)
      break
    end
  end

  if u == path[-1]
    tar_v.each do |n|
      lowest[u] = [lowest[u], prenum[n]].reject(&:nil?).min
      g[u].delete(n)
      g[n].delete(u)
    end

    p = parent[u]
    lowest[p] = [lowest[u], lowest[p]].min
    path.shift
  end
end

res = []

(0..(v-1)).each do |value|
  p = parent[value]
  res << p if prenum[p] <= lowest[value]
  res.uniq!
end

if parent.select{|i| i == 0}.size >= 3
  res << 0
  res.uniq!
else
  res.delete(0)
end

puts res.uniq.sort.join("\n")