#include <bits/stdc++.h>
using namespace std;
int read() {
  char ch = getchar();
  int h = 0, t = 1;
  while ((ch > '9' || ch < '0') && ch != '-') ch = getchar();
  if (ch == '-') t = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') h = h * 10 + ch - '0', ch = getchar();
  return h * t;
}
const int N = 2001000;
struct edge {
  int next, to;
} a[N];
int n, m, Ans, du[N], head[N], cnt = 1;
int dep[N], vis[N], fa[N], ed[N], ve[N];
void link(int x, int y) {
  a[++cnt] = (edge){head[x], y};
  head[x] = cnt;
}
void dfs(int x) {
  for (int i = head[x]; i; i = a[i].next) {
    int R = a[i].to;
    if (R == fa[x]) continue;
    if (!dep[R])
      dep[R] = dep[x] + 1, fa[R] = x, ed[R] = i, dfs(R);
    else if (dep[R] < dep[x]) {
      vis[R] = ve[i] = ve[i ^ 1] = 1;
      for (int p = x; p != R; p = fa[p])
        vis[p] = 1, ve[ed[p]] = ve[ed[p] ^ 1] = 1;
    }
  }
}
void calctree(int x, int rt) {
  if (!vis[x]) vis[x] = 2;
  int s = 0;
  for (int i = head[x]; i; i = a[i].next)
    if (!ve[i]) ve[i] = ve[i ^ 1] = 1, calctree(a[i].to, rt), s++;
  Ans += (s >> 1) + (x == rt && s & 1);
}
void calccircle(int x) {
  vis[x] = 3;
  for (int i = head[x]; i; i = a[i].next) {
    int R = a[i].to;
    if (R == fa[x]) continue;
    if (vis[R] == 1)
      dep[R] = dep[x] + 1, fa[R] = x, calccircle(R);
    else if (vis[R] == 3 && dep[R] < dep[x]) {
      int s = (du[R] > 2);
      for (int p = x; p != R; p = fa[p]) s += (du[p] > 2);
      Ans += (s < 2);
    }
  }
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    link(x, y);
    link(y, x);
    du[x]++;
    du[y]++;
  }
  for (int i = 1; i <= n; i++)
    if (!dep[i]) dep[i] = 1, dfs(i);
  for (int i = 1; i <= n; i++)
    if (vis[i]) calctree(i, i);
  for (int i = 1; i <= n; i++)
    if (!vis[i]) calctree(i, i);
  for (int i = 1; i <= n; i++)
    if (vis[i] == 1) dep[i] = 1, fa[i] = 0, calccircle(i);
  printf("%d %d\n", Ans, m);
}
