class UnionFind
	def initialize(n)
		@parent = (0..n).to_a
		@rank = [0] * (n+1)
	end

	def root(i)
		return i if @parent[i] == i
		@parent[i] = root(@parent[i])
	end	

	def union(i, j)
		u = root(i)
		v = root(j)
		return if u == v
		if @rank[u] > @rank[v]
			@parent[v] = u
		elsif @rank[v] > @rank[u]
			@parent[u] = v
		else
			@parent[u] = v
			@rank[v] += 1
		end
	end

	def same?(i, j)
		root(i) == root(j)
	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] * ' '