require 'tsort'

class Integer
	@@pos = {0b1 => 0}
	@@i = 0
	def one_pos
		a = []
		x = self
		i = 0
		while x > 0
			y = x ^ (x - 1)
			if k = @@pos[y]
				a << k
			else
				loop do
					@@i += 1
					z = (1 << @@i + 1) - 1
					@@pos[z] = @@i
					break if y == z
				end
				a << @@i
			end
			x &= x - 1
		end
		a
	end
end

n, m = gets.split.map &:to_i
g = {}
g_inv = {}
(0..n-1).each {|i| g[i] = []; g_inv[i] = []}

m.times do
	i, j = gets.split.map &:to_i
	g[i] << j
	g_inv[j] << i
end

class << g
	include TSort
	alias tsort_each_node each_key
	def tsort_each_child(i)
		self[i].each{|j| yield j}
	end
end

lower = {}
edge = {}

g.tsort.each do |i|
	l = 1 << i
	e = g_inv[i].map{|j| 1 << j}.inject(0, :|)
	g[i].each do |j|
		l |= lower[j]
		e |= edge[j]
	end
	lower[i] = l
	edge[i] = e
end

t = []

(0..n-1).each do |i|
	queue = [ [0, lower[i], edge[i]] ]
	reached = {lower[i] => 1}
	until queue.empty?
		u = queue.shift
		depth, searched, e = u
		if searched + 1 == (1 << n)
			t[i] = depth
			break
		end
		valid_e = e - (e & searched)
		js = valid_e.one_pos
		js.each {|j| valid_e -= (valid_e & (lower[j] - (1 << j)))}
		valid_e.one_pos.each do |j|
			s = searched | lower[j]
			next if reached[s]
			queue << [depth + 1, s, e | edge[j]]
			reached[s] = 1
		end
	end
end

cost = t.min
cnum = t.count(cost)

puts [cnum, cost] * ' '
puts (0..n-1).select{|i| t[i] == cost} * ' '