class UnionFind
	def initialize
		@obj_to_node = {}
	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

require 'set'

class Graph
	def initialize(*options)
		@options = Set[*options]
	end

	def add_node(property = {})
		Node.new(property)
	end

	def add_edge(u, v, property = {})
		e = Edge.new(u, v, property)
		u.add_edge(e)
		v.add_edge(e)
		e
	end
	
	def del_edge(e)
		u, v = e.opposite.keys
		u.del_edge(e)
		v.del_edge(e)
		e
	end

	class Node
		def initialize(property)
			@property = property
			@edges = Set.new
		end

		def to_s
			@property[:index]
		end

		def add_edge(e)
			@edges << e
		end

		def del_edge(e)
			@edges.delete(e)
		end

		def to_s
			@property[:name] || super
		end

		def each_edge
			@edges.each{|e| 
				yield e
			}
		end

		attr_reader :property, :edges
	end

	class Edge
		def initialize(u, v, property)
			@opposite = {u => v, v => u}
			@property = property
		end
		attr_reader :opposite, :property

		def length
			@property[:length] || 1
		end
	end

	def each_out_connection_of(u)
		u.each_edge{|e|
			yield(e.opposite[u], e.length) }
	end

	alias :each_in_connection_of :each_out_connection_of
end

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

g = Graph.new
nodes = (0..n).map {|i| g.add_node({:index => i})}
edges = []

(1..m).each do
	i, j, c = gets.split.map &:to_i
	edges << g.add_edge(nodes[i], nodes[j], {:length => c})
end
edges.sort_by!(&:length)

mst = []
uf = UnionFind.new

history = {}

edges.each do |e|
	u, v = e.opposite.keys	
	i, j = u.property[:index], v.property[:index]
	#p [u.property[:index], v.property[:index]]
	next if uf.same?(i, j)
	history[e] = [Marshal.load(Marshal.dump(uf)), mst.map(&:length).inject(0, :+)]
	mst << e
	uf.union(i, j)
end

C = mst.map(&:length).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
		u, v = e.opposite.keys	
		i, j = u.property[:index], v.property[:index]
		next if uf.same?(i, j)
		uf.union(i, j)
		c += e.length
		t += 1
	end

	if c > C || t < n - 1
		k += 1
		s += deleted.length
	end
end

puts [k, s] * ' '