class UnionFind
	def initialize(n)
		@obj_to_node = [nil] * (n+1)
	end

	def add(obj)
		@obj_to_node[obj] ||= Node.new(obj)
	end

	def size(x = nil)
		x ? @obj_to_node[x].root.size : @obj_to_node.size
	end

	class Node
		def initialize(obj)
			@obj = obj
			@parent = self
			@size = 1
			@rank = 0
		end

		def root
			return self if @parent == self
			@parent = @parent.root
		end	

		attr_accessor :parent, :size, :rank
	end

	def union(x, y)
		u = (@obj_to_node[x] ||= Node.new(x)).root
		v = (@obj_to_node[y] ||= Node.new(y)).root
		return if u == v
		if u.rank > v.rank
			v.parent = u
			u.size += v.size
		elsif v.rank > u.rank
			u.parent = v
			v.size += u.size
		else
			u.parent = v
			v.rank += 1
			v.size += u.size
		end
	end

	def same?(x, y)
		return false unless u = @obj_to_node[x]
		return false unless v = @obj_to_node[y]
		u.root == v.root
	end
end

n, m = gets.split.map &:to_i

edges = []
cost = (0..n).map{ (0..n).map{ Float::INFINITY} }

(1..m).each do
	i, j, c = gets.split.map &:to_i
	e = [i, j]
	edges << e
	cost[i][j] = cost[j][i] = c
end
edges.sort_by!{|i, j| cost[i][j]}

mst = []
uf = UnionFind.new(n)

history = {}

edges.each do |e|
	i, j = e
	next if uf.same?(i, j)
	history[e] = [Marshal.load(Marshal.dump(uf)), mst.map{|i,j| cost[i][j]}.inject(0, :+)]
	mst << e
	uf.union(i, j)
end

C = mst.map{|i,j| cost[i][j]}.inject(:+)

k = 0
s = 0
mst.each.with_index do |deleted, t0|
	e = nil
	e = edges.shift until e == deleted
	uf, c = history[e]
	t = t0

	edges.each do |e|
		next if e == deleted
		i, j = e
		next if uf.same?(i, j)
		uf.union(i, j)
		c += cost[i][j]
		t += 1
	end

	if c > C || t < n - 1
		k += 1
		s += cost[deleted[0]][deleted[1]]
	end
end

puts [k, s] * ' '