#include <bits/stdc++.h>
using namespace std;
int Input() {
  int x = 0, z = 1;
  char c = getchar();
  for (; c < '0' || c > '9'; c = getchar()) z = c == '-' ? -1 : 1;
  for (; c >= '0' && c <= '9'; c = getchar())
    x = (x << 1) + (x << 3) + (c ^ 48);
  return x * z;
}
const int maxn(1e5 + 5);
const int maxm(6e5 + 5);
int n, m, first[maxn], ans, cnt, fa[maxn], vis[maxn], son[maxn], deep[maxn],
    cov[maxm], fe[maxn];
struct Edge {
  int next, to;
} edge[maxm];
void Add(int u, int v) { edge[cnt] = (Edge){first[u], v}, first[u] = cnt++; }
void Dfs(int u, int ff) {
  for (int e = first[u], v; e != -1; e = edge[e].next)
    if ((v = edge[e].to) != ff) {
      if (!deep[v]) {
        fa[v] = u, deep[v] = deep[u] + 1;
        fe[v] = e, Dfs(v, u);
      } else if (deep[v] < deep[u]) {
        vis[v] = 1, cov[e] = cov[e ^ 1] = 1;
        for (int i = u; i != v; i = fa[i])
          vis[i] = 1, cov[fe[i]] = cov[fe[i] ^ 1] = 1;
      }
    }
}
void Calc(int u, int rt) {
  if (!vis[u]) vis[u] = 2;
  int ret = 0;
  for (int e = first[u]; e != -1; e = edge[e].next)
    if (!cov[e]) cov[e] = cov[e ^ 1] = 1, ++ret, Calc(edge[e].to, rt);
  ans += (ret >> 1);
  if (rt == u && (ret & 1)) ++ans;
}
void Cactus(int u, int ff) {
  vis[u] = 3;
  for (int e = first[u]; e != -1; e = edge[e].next) {
    int v = edge[e].to;
    if (v != ff) {
      if (vis[v] == 1)
        deep[v] = deep[u] + 1, fa[v] = u, Cactus(v, u);
      else if ((vis[v] & 1) && deep[v] < deep[u]) {
        int tot = (son[v] > 0);
        for (int i = u; i != v; i = fa[i]) tot += (son[i] > 0);
        ans += (tot < 2);
      }
    }
  }
}
int main() {
  n = Input(), m = Input();
  for (int i = 1; i <= n; ++i) first[i] = -1;
  for (int i = 1; i <= m; ++i) {
    int u = Input(), v = Input();
    Add(u, v), Add(v, u);
  }
  for (int i = 1; i <= n; ++i)
    if (!deep[i]) deep[i] = 1, Dfs(i, 0);
  for (int i = 1; i <= n; ++i)
    for (int e = first[i]; e != -1; e = edge[e].next)
      if (!cov[e]) ++son[i];
  for (int i = 1; i <= n; ++i)
    if (vis[i] == 1) Calc(i, i);
  for (int i = 1; i <= n; ++i)
    if (!vis[i]) Calc(i, i);
  for (int i = 1; i <= n; ++i)
    if (vis[i] == 1) deep[i] = 1, Cactus(i, 0);
  printf("%d %d\n", ans, m);
  return 0;
}
