#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

using Weight = int;
struct Edge {
	int s, d; Weight w;
	Edge() {};
	Edge(int s, int d, Weight w) : s(s), d(d), w(w) {};
};
bool operator<(const Edge &e1, const Edge &e2) { return e1.w < e2.w; }
bool operator>(const Edge &e1, const Edge &e2) { return e2 < e1; }
inline ostream &operator<<(ostream &os, const Edge &e) { return (os << '(' << e.s << ", " << e.d << ", " << e.w << ')'); }

using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void addArc(Graph &g, int s, int d, Weight w = 1) {
	g[s].emplace_back(s, d, w);
}
void addEdge(Graph &g, int a, int b, Weight w = 1) {
	addArc(g, a, b, w);
	addArc(g, b, a, w);
}

struct UnionFind {
	vector<int> parent;
	int size;
	UnionFind(int n) :parent(n, -1), size(n) {}
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x == y)return false;
		if (sizeOf(x) < sizeOf(y))swap(x, y);
		parent[x] += parent[y]; parent[y] = x; size--;
		return true;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int root(int x) { return parent[x] < 0 ? x : parent[x] = root(parent[x]); }
	int sizeOf(int x) { return -parent[root(x)]; }
};

/*
最小全域木
Kruskal法
非連結グラフでは最小全域森
計算量: O(E log E)
引数: グラフ
戻り値: (総コスト, 辺集合)
*/
pair<Weight, Edges> kruskal(const Graph &g) {
	int n = g.size();
	UnionFind uf(n);
	Edges es;
	for (int i = 0; i < n; i++)
		for (auto &e : g[i])
			es.push_back(e);
	sort(es.begin(), es.end());
	Weight total = 0;
	Edges mst;
	for (auto &e : es)
		if (!uf.same(e.s, e.d)) {
			uf.unite(e.s, e.d);
			mst.push_back(e);
			total += e.w;
		}
	return make_pair(total, mst);
}

/*
最小全域木
Kruskal法
非連結グラフでは最小全域森
計算量: O(E log V) (E = V^2 より log E = 2 log V)
引数: グラフ（行列表現）
戻り値: (総コスト, 辺集合)
*/
pair<Weight, Edges> kruskal(const Matrix &m) {
	int n = m.size();
	Graph g(n);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			if (m[i][j] != INF)
				addArc(g, i, j, m[i][j]);
	return kruskal(g);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M; cin >> N >> M;
	Matrix m(N, Array(N, INF));
	vector<int> s(M), d(M), c(M); rep(i, 0, M) {
		cin >> s[i] >> d[i] >> c[i];
		s[i]--, d[i]--;
		m[s[i]][d[i]] = c[i];
	}

	Weight tot;
	Edges mst;
	tie(tot, mst) = kruskal(m);
	dump(kruskal(m));

	Matrix tm = m;

	int num = 0;
	int cost = 0;
	for (auto e : mst) {
		tm[e.s][e.d] = INF;
		Weight tot2; Edges mst2;
		tie(tot2, mst2) = kruskal(tm);
		dump(kruskal(tm));
		if (tot2 > tot || mst2.size() < mst.size()) {
			num++;
			cost += e.w;
		}
		tm[e.s][e.d] = m[e.s][e.d];
	}

	cout << num << " " << cost << endl;

	return 0;
}
