#include <bits/stdc++.h>
using namespace std;
vector<bool> was;
vector<vector<int> > es;
vector<int> cst;
vector<int> cols;
vector<vector<int> > cycs;
void dfs(int v, int par = -1) {
  was[v] = true;
  cst.push_back(v);
  for (int i = 0; i < ((int)(es[v]).size()); i++) {
    int b = es[v][i];
    if (b == par) continue;
    if (was[b]) {
      if (cols[v] >= 0) {
        assert(cols[v] == cols[b]);
      } else {
        int cid = ((int)(cycs).size());
        cycs.push_back(vector<int>());
        for (int i2 = ((int)(cst).size()) - 1; i2 >= 0; i2--) {
          cycs[cid].push_back(cst[i2]);
          assert(cols[cst[i2]] < 0);
          cols[cst[i2]] = cid;
          if (cst[i2] == b) break;
        }
      }
    } else
      dfs(b, v);
  }
  cst.pop_back();
}
int dfs2(int v, int par = -1) {
  int cid = cols[v];
  int res = ((int)(cycs[cid]).size()) > 1;
  int sumcnt = 0;
  int nzcnt = 0;
  for (int i = 0; i < ((int)(cycs[cid]).size()); i++) {
    int a = cycs[cid][i];
    int subcnt = 0;
    for (int i2 = 0; i2 < ((int)(es[a]).size()); i2++) {
      int b = es[a][i2];
      if (cols[b] == cid) continue;
      int cres = -1;
      if (b != par) {
        cres = dfs2(b, a);
      } else {
        cres = 1;
      }
      res += cres;
      subcnt++;
    }
    res -= subcnt / 2;
    sumcnt += subcnt;
    if (subcnt) nzcnt++;
  }
  if (((int)(cycs[cid]).size()) > 1) {
    if (nzcnt >= 2) {
      res -= 1;
    }
  }
  return res;
}
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) >= 1) {
    es = vector<vector<int> >(n);
    for (int i = 0; i < m; i++) {
      int a, b;
      scanf("%d%d", &a, &b), a--, b--;
      es[a].push_back(b);
      es[b].push_back(a);
    }
    was = vector<bool>(n, false);
    cst.clear();
    cols = vector<int>(n, -1);
    cycs = vector<vector<int> >();
    dfs(0);
    for (int i = 0; i < n; i++)
      if (cols[i] < 0) {
        int cid = ((int)(cycs).size());
        cycs.push_back(vector<int>(1, i));
        cols[i] = cid;
      }
    int ans = dfs2(0);
    printf("%d %d\n", ans, m);
  }
  return 0;
}
