#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
int a, b, c, d, i, j, n, m, k;
vector<int> sm[100001];
int num[100001];
bool used[100001];
vector<int> cycle[100001];
vector<int> st;
int dp[100001][2];
void dfs(int v, int pr = -1) {
  if (used[v]) return;
  st.push_back(v);
  used[v] = 1;
  for (int _n(((int)((sm[v]).size())) - 1), i(0); i <= _n; i++) {
    int w = sm[v][i];
    if (w == pr) continue;
    if (num[v] == -1 && used[w]) {
      for (int i = ((int)((st).size()) - 1), _b = (0); i >= _b; i--) {
        num[st[i]] = k;
        cycle[k].push_back(st[i]);
        if (st[i] == w) break;
      }
      ++k;
    } else {
      dfs(w, v);
    }
  }
  st.pop_back();
}
int rec(int v, int tp, int pr) {
  if (dp[v][tp] != -1) return dp[v][tp];
  if ((int)((cycle[num[v]]).size()) == 1 && (int)((sm[v]).size()) == 1 &&
      pr != -1)
    return dp[v][tp] = tp;
  if (tp == 0) {
    const vector<int> &cur = cycle[num[v]];
    int ans = 1;
    if ((int)((cur).size()) == 1) ans = 0;
    int tot = 0;
    for (int _n(((int)((cur).size())) - 1), i(0); i <= _n; i++) {
      int w = cur[i];
      int cnt = 0;
      for (int _n(((int)((sm[w]).size())) - 1), j(0); j <= _n; j++) {
        int u = sm[w][j];
        if (num[w] == num[u]) continue;
        if (u == pr) continue;
        ans += rec(u, 1, w);
        ++cnt;
      }
      ans -= cnt / 2;
      if (cnt >= 1) ++tot;
    }
    if ((int)((cur).size()) > 1 && tot >= 2) --ans;
    return dp[v][tp] = ans;
  }
  int ans = rec(v, 0, pr) + 1;
  const vector<int> &cur = cycle[num[v]];
  int ans2 = 2;
  int tot = 0;
  for (int _n(((int)((cur).size())) - 1), i(0); i <= _n; i++) {
    int w = cur[i];
    int cnt = 0;
    for (int _n(((int)((sm[w]).size())) - 1), j(0); j <= _n; j++) {
      int u = sm[w][j];
      if (num[w] == num[u]) continue;
      if (u == pr) continue;
      ans2 += rec(u, 1, w);
      ++cnt;
    }
    if (w == v && pr != -1) ++cnt;
    ans2 -= cnt / 2;
    if (cnt >= 1) ++tot;
  }
  if (tot >= 2 || (int)((cur).size()) == 1) --ans2;
  ans = min(ans, ans2);
  return dp[v][1] = ans;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int _n((m)-1), i(0); i <= _n; i++) {
    scanf("%d%d", &a, &b);
    --a;
    --b;
    sm[a].push_back(b);
    sm[b].push_back(a);
  }
  memset(num, -1, sizeof(num));
  dfs(0);
  for (int _n((n)-1), i(0); i <= _n; i++) {
    if (num[i] == -1) {
      cycle[k].push_back(i);
      num[i] = k++;
    }
  }
  memset(dp, -1, sizeof(dp));
  int ans = rec(0, 0, -1);
  printf("%d %d\n", ans, m);
}
