#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
int n, m;
vector<int> g[maxn];
int dfn[maxn], clk;
int stk[maxn], top;
int cnt_cyc, cyc_id[maxn], cnt_edge[maxn];
vector<int> cyc[maxn];
int Dfs(int u, int p) {
  int low = dfn[u] = clk++;
  stk[top++] = u;
  for (int v : g[u]) {
    if (v == p) {
      continue;
    }
    if (dfn[v] == -1) {
      low = min(low, Dfs(v, u));
    } else if (dfn[v] < dfn[u]) {
      low = min(low, dfn[v]);
    }
  }
  if (dfn[u] == low) {
    while (true) {
      int v = stk[--top];
      cyc_id[v] = cnt_cyc;
      cyc[cnt_cyc].push_back(v);
      if (v == u) break;
    }
    ++cnt_cyc;
  }
  return low;
}
void FindCycles(void) {
  memset(dfn, -1, sizeof dfn);
  Dfs(0, -1);
  for (int u = 0; u < n; ++u) {
    cnt_edge[u] = g[u].size();
    if (cyc[cyc_id[u]].size() > 1) {
      cnt_edge[u] -= 2;
    }
  }
  for (int i = 0; i < cnt_cyc; ++i) {
    for (int &x : cyc[i]) {
      x = cnt_edge[x];
    }
  }
}
int SolveCycle(vector<int> &c) {
  if (c.size() == 1) {
    return c[0] >> 1;
  }
  int cnt = 0, sum = 0;
  for (int x : c) {
    cnt += !!x;
    sum += x;
  }
  if (cnt <= 1) {
    return (sum >> 1) - 1;
  }
  int ans = 0;
  for (int x : c) {
    ans += x >> 1;
  }
  return ans;
}
int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    --u;
    --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  FindCycles();
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += cnt_edge[i];
  }
  ans >>= 1;
  for (int i = 0; i < cnt_cyc; ++i) {
    ans -= SolveCycle(cyc[i]);
  }
  printf("%d %d\n", ans, m);
  return 0;
}
