#include <bits/stdc++.h>
struct MyStruct {
  int from, to, cost;
};
MyStruct D[1003];
long long int G[103][103];
using namespace std;
int main() {
  long long int N, M;
  cin >> N >> M;
  int a, b, c;
  for (int i = 0; i < 102; i++) {
    for (int j = 0; j < 102; j++) {
      G[i][j] = 100000000;
    }
  }
  for (int i = 0; i < M; i++) {
    cin >> a >> b >> c;
    G[a][b] = c;
    G[b][a] = c;
    D[i].from = a;
    D[i].to = b;
    D[i].cost = c;
  }
  for (int k = 0; k < N; k++) {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
      }
    }
  }
  int Y = 0;
  for (int j = 0; j < M; j++) {
    for (int i = 1; i <= N; i++) {
      if (G[i][D[j].to] == D[j].cost + G[i][D[j].from]) {
        Y++;
        goto go;
        ;
      }
    }
  go:;
  }
  cout << Y << endl;
  cout << M - Y - 1 << endl;
  return 0;
}
