using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        private static void SolveA(string[] args)
        {
            int[] ve = ReadAndParseIntArr();
            int v = ve[0];
            int e = ve[1];
            List<int>[] graph = new List<int>[v];
            // 初期化
            for (int i = 0; i < v; ++i)
            {
                var list = new List<int>();

                graph[i] = list;
            }

            for (int i=0;i<e;++i)
            {
                int[] st = ReadAndParseIntArr();
                graph[st[0]].Add(st[1]);
                graph[st[1]].Add(st[0]);
            }
            prenum = new int[v];
            parent = new int[v];
            for(int i = 0; i < v; ++i) { parent[i] = -1; }
            lowest = new int[v];
            for(int i=0;i<v;++i)
            {
                lowest[i] = calcLowest(i, graph);
            }
            int[] color = new int[v];
            var outList = new List<int>();

            dfs(0, color, graph);

            // 1
            int root = 0;
            int rootParentCnt = 0;
            foreach(int u in parent)
            {
                if( u == root)
                {
                    rootParentCnt++;
                }
            }
            if( rootParentCnt >= 2)
            {
                outList.Add(0);
            }

            // 2
            for(int i=1;i<v;++i)
            {
                int p = parent[i];
                if( p == root) { continue; }
                if( prenum[p] <= lowest[i])
                {
                    if (!outList.Contains(p))
                    {
                        outList.Add(p);
                    }
                }
            }

            outList.Sort();
            foreach(int u in outList)

            {
                Console.WriteLine(u);
            }
        }
        private static int visitId = 1;
        private static int[] prenum;
        private static int[] parent;
        private static int[] lowest;
        private const int kWhite = 0;
        private const int kGray = 1;
        private static List<int> candidates = new List<int>();
        private static int calcLowest(int u, List<int>[] graph)
        {
            candidates.Clear();
            // 1
            candidates.Add( prenum[u]);

            // 2
            List<int> list = graph[u];
            
            foreach(int v in list)
            {
                // このvがTにおｋる接続でないならbackedge
                if(IsBackEdge(v, u, parent))
                {
                    // backedge
                    candidates.Add(prenum[v]);
                }
            }
            // 3
            for(int x =0;x<parent.Length;++x)
            {
                if( parent[x] == u)
                {
                    // child
                    candidates.Add(lowest[x]);
                }
            }

            return candidates.Min();
        }
        private static bool IsBackEdge(int v, int u, int[] parent)
        {
            if( parent[u] == v) { return false; }
            for(int child = 0;child < parent.Length;++child)
            {
                if(parent[child] == u && child == v) { return false; }
            }
            return true;
        }
        private static void dfs(int u, int[] color, List<int>[] graph)
        {
            color[u] = kGray;

            // preorder
            prenum[u] = visitId;
            visitId++;
            List<int> list = graph[u];
            foreach(int v in list)
            {
                if( color[v] == kWhite)
                {
                    parent[v] = u;
                    dfs(v, color, graph);
                }
            }

            // postorder
            lowest[u] = calcLowest(u, graph);
        }
    }
}



Measured memory_bytes: 23288