2 0
 100000 0
 8 9
1 2
2 3
3 4
4 1
5 6
6 7
7 8
8 5
6 8
 2 1
1 2
 11 9
5 9
8 5
11 3
11 1
3 4
7 11
3 1
11 2
7 2
 7 9
7 3
7 4
1 2
2 3
3 1
3 4
4 5
5 6
6 4
 7 5
5 4
7 3
7 1
6 7
3 1
 7 8
1 2
2 3
3 4
4 1
3 5
5 6
6 7
7 3
 6 9
1 2
2 3
1 4
4 2
5 2
5 3
4 5
6 4
6 5
 7 9
1 2
2 4
4 3
3 1
2 3
4 5
5 6
6 7
7 4
 1 0
 6 7
1 2
2 3
3 1
3 4
4 5
5 6
6 4
 4 5
1 2
2 3
3 4
4 1
1 3
 100000 3
99998 99999
99999 100000
100000 99998

0

 0

 4
1 2 3 4 
 0

 6
3 4 6 7 8 9 
 9
1 2 3 4 5 6 7 8 9 
 3
2 3 5 
 8
1 2 3 4 5 6 7 8 
 0

 4
6 7 8 9 
 0

 6
1 2 3 5 6 7 
 0

 3
1 2 3 

import java.util.*;

public class Test {
    public static void main(String args[])
    {
        new Test(new Scanner(System.in));
    }

    Graph g;
    int cnt;
    ArrayList<Integer> bridges;
    ArrayList<Integer> ans;
    ArrayList<ArrayList<Integer>> comps;
    int[] pre, low, stk;
    boolean[] art, used;

    int dfs(int i, int p, int id)
    {
        if(!used[id])
        {
            used[id] = true;
            stk[++stk[0]] = id; // push onto a stack
        }

        if(pre[i] != -1)
        {
            low[p] = Math.min(low[p], pre[i]);
            return low[p];
        }

        pre[i] = cnt++;
        low[i] = pre[i];
        boolean hasFwd = false;

        for(Edge e : g.adj[i])
        {
            if(e.id == id) continue;

            if(dfs(e.j, i, e.id) < 0)
            {
                low[i] = Math.min(low[i], low[e.j]);

                if(low[e.j] == pre[e.j]) {
                    bridges.add(e.id+1);
                }

                if(i != p ? low[e.j] >= pre[i] : hasFwd)
                {
                    art[i] = true;
                    makeComp(e.id).add(stk[stk[0]--] + 1);
                }

                hasFwd = true;
            }
        }
        return -1;
    }

    ArrayList<Integer> makeComp(int id)
    {
        ArrayList<Integer> comp = new ArrayList<>();
        while(stk[stk[0]] != id)
            comp.add(stk[stk[0]--] + 1); // Pop of the stack
        comps.add(comp);
        return comp;
    }

    Test(Scanner in)
    {
        g = new Graph(in.nextInt()+1);
        int M = in.nextInt();

        while(M-->0)
        {
            int i = in.nextInt();
            int j = in.nextInt();
            g.add(i, j);
        }

        stk = new int[g.M+2];
        pre = new int[g.N];
        low = new int[g.N];
        used = new boolean[g.M+1];
        Arrays.fill(pre, -1);
        bridges = new ArrayList<>();
        comps = new ArrayList<>();
        art = new boolean[g.N];
        ans = new ArrayList<>();

        for(int i=0; i<g.N; i++)
        {
            if(pre[i] == -1) {
                used[g.M] = false;

                dfs(i, i, g.M);

                if(stk[0] > 1)
                    makeComp(g.M);
                stk[0] = 0;
            }
        }

        ArrayList<Integer> arts = new ArrayList<>();
        for(int i=0; i<g.N; i++)
            if(art[i])
                arts.add(i);

//        System.out.printf("Art pts are: %s", arts);

//        System.out.printf("%n%d 2-vertex-connected components found:%n", comps.size());

        for(ArrayList<Integer> comp : comps)
        {
            for(int i=0; i<comp.size() && comps.size() > 2; i++)
                if(comp.size() > 1)
            ans.add(comp.get(i));

        }

        Collections.sort(ans);
        System.out.println(ans.size());
        ans.toString().replaceAll("[\\[\\]]","");

        for(int i=0; i<ans.size(); i++)
            System.out.print(ans.get(i) + " ");


    }

    class Graph
    {
        int N, M;

        ArrayList<Edge>[] adj;

        Graph(int NN)
        {
            M = 0;
            adj = new ArrayList[N=NN];
            for(int i=0; i<N; i++)
                adj[i] = new ArrayList<>();
        }

        void add(int i, int j)
        {
            adj[i].add(new Edge(j, M));
            adj[j].add(new Edge(i, M));
            M++;
        }
    }

    class Edge
    {
        int j, id;

        Edge(int jj, int ii) {
            j=jj; id=ii;
        }
    }
}



































































