/+ dub.sdl:
    name "A"
    dependency "dcomp" version=">=0.7.1"
+/
//extern(C) __gshared string[] rt_options = ["gcopt=minPoolSize:32 maxPoolSize:32 heapSizeFactor:1"];
//extern(C) __gshared string[] _rt_options = ["gcopt=minPoolSize:32 maxPoolSize:32 heapSizeFactor:1"];

import std.stdio, std.algorithm, std.range, std.conv;
// import dcomp.foundation, dcomp.scanner, dcomp.array;
import std.functional : binaryFun;
 
// import dcomp.algorithm;
// import dcomp.graph.primitive;

// import dcomp.graph.dijkstra;
// import dcomp.graph.directedmst;
 
import std.typecons;
alias E = Tuple!(int, "to", int, "dist");
 
void main() {
    auto sc = new Scanner(stdin);
    int n, m;
    sc.read(n, m);
    E[][] g = new E[][n];
    auto ok = true.repeat.take(n).array;
    foreach (i; 0..m) {
        int a, b;
        sc.read(a, b);
        g[a] ~= E(b, 1);
        g[b] ~= E(a, 0);
        ok[b] = false;
    }
    int[] vl;
    foreach (i; 0..n) {
        if (ok[i]) vl ~= i;
    }
 
/*    E[][] ng = new E[][vl.length];
    foreach (i; 0..vl.length) {
        auto dist = dijkstra!(int)(g, vl[i]).dist;
        foreach (int j; 0..vl.length.to!int) {
            if (i == j) continue;
            ng[i] ~= E(j, dist[vl[j]]);
        }
    }*/
    
    int mic = 1<<28;
    int[] ans;
    foreach (i; 0..vl.length) {
//        auto u = directedMST(ng, i).cost;
        auto u = directedMST(g, vl[i]).cost;
        if (u < mic) {
            mic = u;
            ans = [vl[i]];
        } else if (u == mic) {
            ans ~= vl[i];
        }
    }
    writeln(ans.length, " ", mic);
    writeln(ans.map!(to!string).join(" "));
    return;
}
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/container/radixheap.d */
// module dcomp.container.radixheap;

// import dcomp.foundation;
// import dcomp.array;


import std.functional : unaryFun;
import std.traits : isSigned, isUnsigned;

template RadixHeap(T, alias _pred = "a")
if (isSigned!(typeof(unaryFun!_pred(T())))) {
    import std.traits : Unsigned;
    alias pred = unaryFun!_pred;
    alias S = typeof(pred(T()));
    alias U = Unsigned!S;
    U pred2(in T x) {
        return pred(x) ^ (U(1) << (U.sizeof*8-1));
    }
    alias RadixHeap = RadixHeap!(T, pred2);
}

import core.bitop;

struct RadixHeap(T, alias _pred = "a")
if (isUnsigned!(typeof(unaryFun!_pred(T())))) {
    import std.algorithm;
    import core.exception : RangeError;
    alias pred = unaryFun!_pred;
    alias U = typeof(pred(T()));
    static int bsr1(U x) {
        return (x == 0) ? 0 : bsr(x)+1;
    }
    static struct Payload {
        FastAppender!(T[])[U.sizeof*8+1] v;
        size_t length;
        U last;
        void insert(T p) {
            U x = pred(p);
            assert(last <= x);
            length++;
            v[bsr1(x^last)] ~= p;
        }
        bool empty() const {
            return length == 0;
        }
        T front() {
            if (!v[0].length) {
                int i = 1;
                while (!v[i].length) i++;
                last = v[i].data[].map!pred.fold!"min(a, b)";
                foreach (T p; v[i].data) {
                    v[bsr1(pred(p)^last)] ~= p;
                }
                v[i].clear();
            }
            return v[0].data[$-1];
        }
        void removeFront() {
            front();
            length--;
            v[0].removeBack();
        }        
    }
    Payload* p;
    private void I() { if (!p) p = new Payload(); }
    private void C() const {
        version(assert) if (!p) throw new RangeError();
    }
    void insert(T x) {I; p.insert(x); }
    @property bool empty() const { return (p == null || p.empty); }
    @property size_t length() const { return (p ? p.length : 0); }
    T front() {C; return p.front; }
    void removeFront() {I; p.removeFront(); }
}

 

 
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/algorithm.d */
// module dcomp.algorithm;

import std.range.primitives;
import std.traits : isFloatingPoint, isIntegral;

 
T binSearch(alias pred, T)(T l, T r) if (isIntegral!T) {
    while (r-l > 1) {
        T md = (l+r)/2;
        if (!pred(md)) l = md;
        else r = md;
    }
    return r;
}

 
T binSearch(alias pred, T)(T l, T r, int cnt = 60) if (isFloatingPoint!T) {
    foreach (i; 0..cnt) {
        T md = (l+r)/2;
        if (!pred(md)) l = md;
        else r = md;
    }
    return r;
}

 
 

 
E minimum(alias pred = "a < b", Range, E = ElementType!Range)(Range range, E seed)
if (isInputRange!Range && !isInfinite!Range) {
    import std.algorithm, std.functional;
    return reduce!((a, b) => binaryFun!pred(a, b) ? a : b)(seed, range);
}

 
ElementType!Range minimum(alias pred = "a < b", Range)(Range range) {
    assert(!range.empty, "range must not empty");
    auto e = range.front; range.popFront;
    return minimum!pred(range, e);
}

 
 

 
E maximum(alias pred = "a < b", Range, E = ElementType!Range)(Range range, E seed)
if (isInputRange!Range && !isInfinite!Range) {
    import std.algorithm, std.functional;
    return reduce!((a, b) => binaryFun!pred(a, b) ? b : a)(seed, range);
}

 
ElementType!Range maximum(alias pred = "a < b", Range)(Range range) {
    assert(!range.empty, "range must not empty");
    auto e = range.front; range.popFront;
    return maximum!pred(range, e);
}

 
 

 
Rotator!Range rotator(Range)(Range r) {
    return Rotator!Range(r);
}

 
struct Rotator(Range)
if (isForwardRange!Range && hasLength!Range) {
    size_t cnt;
    Range start, now;
    this(Range r) {
        cnt = 0;
        start = r.save;
        now = r.save;
    }
    this(this) {
        start = start.save;
        now = now.save;
    }
    @property bool empty() {
        return now.empty;
    }
    @property auto front() {
        assert(!now.empty);
        import std.range : take, chain;
        return chain(now, start.take(cnt));
    }
    @property Rotator!Range save() {
        return this;
    }
    void popFront() {
        cnt++;
        now.popFront;
    }
}

 
 
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/graph/dijkstra.d */
// module dcomp.graph.dijkstra;

// import dcomp.algorithm, dcomp.container.radixheap;

struct DijkstraInfo(T) {
    T[] dist;
    int[] from;
    this(int n, T inf) {
        dist = new T[n]; dist[] = inf;
        from = new int[n];
    }
}

DijkstraInfo!D dijkstra(D, T)(T g, int s, D inf = D.max) {
    import std.conv : to;
    import std.typecons : Tuple;
    import std.container : make, Array, heapify;
    import std.container.binaryheap : BinaryHeap;
    import std.traits : isIntegral;

    int V = g.length.to!int;
    auto dijk = DijkstraInfo!D(V, inf);
    with (dijk) {        
        alias P = Tuple!(int, "to", D, "dist");
        auto q = (){
            static if (isIntegral!D) {
                return RadixHeap!(P, "a.dist")();
            } else {
                return heapify!"a.dist>b.dist"(make!(Array!P));
            }
        }();
        q.insert(P(s, D(0)));
        dist[s] = D(0);
        from[s] = -1;
        while (!q.empty) {
            P p = q.front; q.removeFront();
            if (dist[p.to] < p.dist) continue;
            foreach (e; g[p.to]) {
                if (p.dist+e.dist < dist[e.to]) {
                    dist[e.to] = p.dist+e.dist;
                    from[e.to] = p.to;
                    q.insert(P(e.to, dist[e.to]));
                }
            }
        }
    }
    return dijk;
}

DijkstraInfo!D dijkstraDense(D, T)(T g, int s, D inf = D.max) {
    import std.conv : to;
    import std.typecons : Tuple;
    import std.container : make, Array, heapify;
    import std.range : enumerate;
    import std.algorithm : filter;

    int V = g.length.to!int;
    auto dijk = DijkstraInfo!D(V, inf);
    with (dijk) {
        alias P = Tuple!(int, "to", D, "dist");

        bool[] used = new bool[](V);
        dist[s] = D(0);
        from[s] = -1;
        while (true) {
             
            auto rng = dist.enumerate.filter!(a => !used[a.index]);
            if (rng.empty) break;
            auto nx = rng.minimum!"a.value < b.value";
            used[nx.index] = true;
            P p = P(nx.index.to!int, nx.value); 
            if (p.dist == inf) continue;
            foreach (e; g[p.to]) {
                if (p.dist+e.dist < dist[e.to]) {
                    dist[e.to] = p.dist+e.dist;
                    from[e.to] = p.to;
                }
            }
        }
    }
    return dijk;
}

 

 
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/scanner.d */
// module dcomp.scanner;

// import dcomp.array;

 
class Scanner {
    import std.stdio : File;
    import std.conv : to;
    import std.range : front, popFront, array, ElementType;
    import std.array : split;
    import std.traits : isSomeChar, isStaticArray, isArray; 
    import std.algorithm : map;
    File f;
    this(File f) {
        this.f = f;
    }
    char[512] lineBuf;
    char[] line;
    private bool succW() {
        import std.range.primitives : empty, front, popFront;
        import std.ascii : isWhite;
        while (!line.empty && line.front.isWhite) {
            line.popFront;
        }
        return !line.empty;
    }
    private bool succ() {
        import std.range.primitives : empty, front, popFront;
        import std.ascii : isWhite;
        while (true) {
            while (!line.empty && line.front.isWhite) {
                line.popFront;
            }
            if (!line.empty) break;
            line = lineBuf[];
            f.readln(line);
            if (!line.length) return false;
        }
        return true;
    }

    private bool readSingle(T)(ref T x) {
        import std.algorithm : findSplitBefore;
        import std.string : strip;
        import std.conv : parse;
        if (!succ()) return false;
        static if (isArray!T) {
            alias E = ElementType!T;
            static if (isSomeChar!E) {
                 
                 
                auto r = line.findSplitBefore(" ");
                x = r[0].strip.dup;
                line = r[1];
            } else static if (isStaticArray!T) {
                foreach (i; 0..T.length) {
                    bool f = succW();
                    assert(f);
                    x[i] = line.parse!E;
                }
            } else {
                FastAppender!(E[]) buf;
                while (succW()) {
                    buf ~= line.parse!E;
                }
                x = buf.data;
            }
        } else {
            x = line.parse!T;
        }
        return true;
    }
    int read(T, Args...)(ref T x, auto ref Args args) {
        if (!readSingle(x)) return 0;
        static if (args.length == 0) {
            return 1;
        } else {
            return 1 + read(args);
        }
    }
}


 
 

 
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/graph/primitive.d */
// module dcomp.graph.primitive;

 

import std.range : ElementType;
alias EdgeType(R) = ElementType!(ElementType!R);
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/foundation.d */
// module dcomp.foundation;
 
static if (__VERSION__ <= 2070) {
    /*
    Copied by https://github.com/dlang/phobos/blob/master/std/algorithm/iteration.d
    Copyright: Andrei Alexandrescu 2008-.
    License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0).
    */
    template fold(fun...) if (fun.length >= 1) {
        auto fold(R, S...)(R r, S seed) {
            import std.algorithm : reduce;
            static if (S.length < 2) {
                return reduce!fun(seed, r);
            } else {
                import std.typecons : tuple;
                return reduce!fun(tuple(seed), r);
            }
        }
    }
     
}
version (X86) static if (__VERSION__ < 2071) {
    import core.bitop : bsf, bsr, popcnt;
    int bsf(ulong v) {
        foreach (i; 0..64) {
            if (v & (1UL << i)) return i;
        }
        return -1;
    }
    int bsr(ulong v) {
        foreach_reverse (i; 0..64) {
            if (v & (1UL << i)) return i;
        }
        return -1;   
    }
    int popcnt(ulong v) {
        int c = 0;
        foreach (i; 0..64) {
            if (v & (1UL << i)) c++;
        }
        return c;
    }
}
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/array.d */
// module dcomp.array;

 
T[N] fixed(T, size_t N)(T[N] a) {return a;}

 
 

 
struct FastAppender(A, size_t MIN = 4) {
    import std.algorithm : max;
    import std.conv;
    import std.range.primitives : ElementEncodingType;
    import core.stdc.string : memcpy;

    private alias T = ElementEncodingType!A;
    private T* _data;
    private uint len, cap;
     
    @property size_t length() const {return len;}
    bool empty() const { return len == 0; }
     
    void reserve(size_t nlen) {
        import core.memory : GC;
        if (nlen <= cap) return;
        
        void* nx = GC.malloc(nlen * T.sizeof);

        cap = nlen.to!uint;
        if (len) memcpy(nx, _data, len * T.sizeof);
        _data = cast(T*)(nx);
    }
    void free() {
        import core.memory : GC;
        GC.free(_data);
    }
     
    void opOpAssign(string op : "~")(T item) {
        if (len == cap) {
            reserve(max(MIN, cap*2));
        }
        _data[len++] = item;
    }
     
    void insertBack(T item) {
        this ~= item;
    }
     
    void removeBack() {
        len--;
    }
     
    void clear() {
        len = 0;
    }
    ref inout(T) back() inout { assert(len); return _data[len-1]; }
    ref inout(T) opIndex(size_t i) inout { return _data[i]; }
     
    T[] data() {
        return (_data) ? _data[0..len] : null;
    }
}

 
 
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/graph/directedmst.d */
// module dcomp.graph.directedmst;

// import dcomp.array;

import std.stdio;

DirectedMSTInfo!(_E, D) directedMST(T, _E = EdgeType!T, D = typeof(_E.dist))(T _g, size_t r) {
    import std.algorithm, std.range, std.conv, std.typecons;
    alias E = Tuple!(int, "from", _E, "edge");

    static struct PairingHeapAllAdd {
        alias NP = Node*;
        static struct Node {        
            E e;
            D offset;
            NP head, next;
            this(E e) { this.e = e; }
        }
        NP n;
        size_t length;
        this(E[] e) {
            length = e.length;            
            foreach (d; e) {
                n = merge(n, new Node(d));
            }
        }
        static NP merge(NP x, NP y) {
            if (!x) return y;
            if (!y) return x;
            if (x.e.edge.dist+x.offset > y.e.edge.dist+y.offset) swap(x, y);
            y.offset -= x.offset;
            y.next = x.head;
            x.head = y;
            return x;
        }
        void C() { assert(n); }
        E front() {C; return n.e; }
        void removeFront() {
            assert(n);
            assert(length > 0);
            length--;
            NP x;
            NP s = n.head;
            while (s) {
                NP a, b;
                a = s; s = s.next; a.next = null; a.offset += n.offset;
                if (s) {
                    b = s; s = s.next; b.next = null; b.offset += n.offset;
                }
                a = merge(a, b);
                assert(a);
                if (!x) x = a;
                else {
                    a.next = x.next;
                    x.next = a;
                }
            }
            n = null;
            while (x) {
                NP a = x; x = x.next;
                n = merge(a, n);
            }
        }
        void meld(PairingHeapAllAdd r) {
            length += r.length;
            n = merge(n, r.n);
        }
        ref D offset() {C; return n.offset; }
    }
    
    auto n = _g.length;
    auto heap = new PairingHeapAllAdd[2*n];
    foreach (i; 0..n) {
        heap[i] = PairingHeapAllAdd(_g[i].map!(e => E(i.to!int, e)).array);
    }

     
    int[] tr = new int[2*n]; tr[] = -1;
    int[] uf = new int[2*n]; uf[] = -1;
    int root(int i) {
        if (uf[i] == -1) return i;
        return uf[i] = root(uf[i]);
    }

    int[] used = new int[2*n];
    E[] res = new E[2*n];
    int c = 1, pc = n.to!int;
    used[r] = 1;
    void mark(int p) {
        c++;
        while (used[p] == 0 || used[p] == c) {
            if (used[p] == c) {
                 
                int np = pc++;
                int q = p;
                do {
                    heap[q].offset -= res[q].edge.dist + heap[q].offset;
                    heap[np].meld(heap[q]);
                    tr[q] = uf[q] = np;
                    q = root(res[q].edge.to);
                } while (q != np);
                p = np;
            }
            assert(used[p] == 0);
            used[p] = c;

            assert(root(p) == p);
            while (heap[p].length && root(heap[p].front.edge.to) == p) {
                heap[p].removeFront;
            }
            assert(heap[p].length);
            E mi = heap[p].front;
            res[p] = mi;
            p = root(mi.edge.to);
        }
    }
    foreach (i; 0..n) {
        if (used[i]) continue;
        mark(i.to!int);
    }

    auto info = DirectedMSTInfo!(_E, D)(n);
    bool[] vis = new bool[pc];
    foreach_reverse (i; 0..pc) {
        if (i == r) continue;
        if (vis[i]) continue;
        int f = res[i].from.to!int;
        while (f != -1 && !vis[f]) {
            vis[f] = true;
            f = tr[f];
        }
        info.cost += res[i].edge.dist;
        info.res[res[i].from] = res[i].edge;
    }
    return info;
}



// import dcomp.algorithm;
// import dcomp.graph.primitive;
struct DirectedMSTInfo(E, C) {
    C cost;
    E[] res;
    this(size_t n) {
        cost = C(0);
        res = new E[n];
    }
}



DirectedMSTInfo!(E, typeof(E.dist)) directedMSTSlow(T, E = EdgeType!T)(T g, size_t r) {
    import std.algorithm : filter;
    auto n = g.length;
    auto info = DirectedMSTInfo!(E, typeof(E.dist))(n);
    with (info) {
        foreach (i; 0..n) {
            if (i == r) continue;
            assert(g[i].filter!(e => e.to != i).empty == false);
            res[i] = g[i].filter!(e => e.to != i).minimum!"a.dist < b.dist";
            cost += res[i].dist;
        }
        int[] i2g = new int[n]; i2g[] = -1;
        i2g[r] = 0;
 
        int gc = 1;
        for (int i = 0; i < n; i++) {
            if (i2g[i] != -1) continue;
            int j = i;
            do {
                i2g[j] = gc++;
                j = res[j].to;
            } while (i2g[j] == -1);
            if (i2g[j] < i2g[i]) continue;
             
            int k = j;
            do {
                i2g[k] = i2g[j];
                k = res[k].to;
            } while(k != j);
            gc = i2g[j]+1;
        }
        if (gc == n) return info;
        E[][] ng = new E[][](gc);
        for (int i = 0; i < n; i++) {
            if (i == r) continue;
            foreach (e; g[i]) {
                if (i2g[e.to] == i2g[i]) continue;
                e.to = i2g[e.to];
                e.dist -= res[i].dist;
                ng[i2g[i]] ~= e;
            }
        }
        auto nme = directedMSTSlow(ng, 0).res;
        bool[] ok = new bool[gc];
        for (int i = 0; i < n; i++) {
            if (i == r || ok[i2g[i]]) continue;
            foreach (e; g[i]) {
                if (e.dist - res[i].dist == nme[i2g[i]].dist && i2g[e.to] == nme[i2g[i]].to) {
                    ok[i2g[i]] = true;
                    res[i] = e;
                    cost += nme[i2g[i]].dist;
                    break;
                }
            }
        }
 
    }
    return info;
}

 

 

/*
This source code generated by dcomp and include dcomp's source code.
dcomp's Copyright: Copyright (c) 2016- Kohei Morita. (https://github.com/yosupo06/dcomp)
dcomp's License: MIT License(https://github.com/yosupo06/dcomp/blob/master/LICENSE.txt)
*/