#include <bits/stdc++.h>
using namespace std;
struct edge {
  int v;
  bool chk;
  edge *nxt, *anti;
} e[600050], *upedge[100050], *head[100050];
int cnt[100050], col[100050], pre[100050];
int ecnt;
bool v[100050], flg[100050];
edge *adde(int u, int v) {
  edge *e2 = &e[++ecnt];
  e2->v = v;
  e2->chk = true;
  e2->nxt = head[u];
  head[u] = e2;
  return e2;
}
void Addedge(int u, int v) {
  edge *e1 = adde(u, v);
  edge *e2 = adde(v, u);
  e1->anti = e2;
  e2->anti = e1;
}
void dfs1(int u, int fa) {
  col[u] = 0;
  for (edge *p = head[u]; p; p = p->nxt) {
    if (col[p->v] == -1) {
      upedge[p->v] = p;
      pre[p->v] = u;
      dfs1(p->v, u);
    } else if (p->v != fa && col[p->v] == 0) {
      p->chk = p->anti->chk = false;
      for (int now = u; now != p->v; now = pre[now])
        upedge[now]->chk = upedge[now]->anti->chk = false, flg[now] = true;
      flg[p->v] = true;
    }
  }
  col[u] = 1;
}
void dfs2(int u, int fa, int &ans) {
  v[u] = true;
  cnt[u] = 0;
  for (edge *p = head[u]; p; p = p->nxt) {
    if (p->chk && !v[p->v]) {
      dfs2(p->v, u, ans);
      cnt[u]++;
      cnt[p->v]++;
    }
  }
  ans += cnt[u] / 2;
  if (fa == -1 && cnt[u] % 2 == 1) ans++;
}
void dfs3(int u, int fa, int &ans) {
  col[u] = 0;
  for (edge *p = head[u]; p; p = p->nxt) {
    if (col[p->v] == -1) {
      pre[p->v] = u;
      dfs3(p->v, u, ans);
    } else if (p->v != fa && col[p->v] == 0) {
      int tot = 0;
      for (int now = u; now != p->v; now = pre[now])
        if (cnt[now] > 0) tot++;
      if (cnt[p->v] > 0) tot++;
      if (tot <= 1) ans++;
    }
  }
  col[u] = 1;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) head[i] = 0;
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    Addedge(u, v);
  }
  memset(col, -1, sizeof(col));
  memset(flg, 0, sizeof(flg));
  for (int i = 1; i <= n; ++i)
    if (col[i] == -1) dfs1(i, -1);
  memset(v, 0, sizeof(v));
  int ans = 0;
  for (int i = 1; i <= n; ++i)
    if (flg[i] && !v[i]) dfs2(i, -1, ans);
  for (int i = 1; i <= n; ++i)
    if (!v[i]) dfs2(i, -1, ans);
  memset(col, -1, sizeof(col));
  for (int i = 1; i <= n; ++i)
    if (col[i] == -1) dfs3(i, -1, ans);
  printf("%d %d\n", ans, m);
}
