#include <bits/stdc++.h>
using namespace std;
struct node {
  int data;
  bool check;
  node *next, *anti;
} * ge[100000], *upEdge[100000];
int cnt[100000], color[100000], pre[100000];
bool v[100000], flag[100000];
node *addEdge(int a, int b) {
  static node buf[600000];
  static int top = 0;
  node *p = &buf[top++];
  p->data = b;
  p->check = true;
  p->next = ge[a];
  ge[a] = p;
  return p;
}
void insertEdge(int a, int b) {
  node *p1 = addEdge(a, b);
  node *p2 = addEdge(b, a);
  p1->anti = p2;
  p2->anti = p1;
}
void dfs1(int i, int fa) {
  color[i] = 0;
  for (node *p = ge[i]; p; p = p->next)
    if (color[p->data] == -1) {
      upEdge[p->data] = p;
      pre[p->data] = i;
      dfs1(p->data, i);
    } else if (p->data != fa && color[p->data] == 0) {
      p->check = p->anti->check = false;
      for (int now = i; now != p->data; now = pre[now]) {
        upEdge[now]->check = upEdge[now]->anti->check = false;
        flag[now] = true;
      }
      flag[p->data] = true;
    }
  color[i] = 1;
}
void dfs2(int i, int fa, int &ans) {
  v[i] = true;
  cnt[i] = 0;
  for (node *p = ge[i]; p; p = p->next)
    if (p->check && !v[p->data]) {
      dfs2(p->data, i, ans);
      cnt[i]++;
      cnt[p->data]++;
    }
  ans += cnt[i] / 2;
  if (fa == -1 && cnt[i] % 2 == 1) ans++;
}
void dfs3(int i, int fa, int &ans) {
  color[i] = 0;
  for (node *p = ge[i]; p; p = p->next)
    if (color[p->data] == -1) {
      pre[p->data] = i;
      dfs3(p->data, i, ans);
    } else if (p->data != fa && color[p->data] == 0) {
      int tot = 0;
      for (int now = i; now != p->data; now = pre[now])
        if (cnt[now] > 0) tot++;
      if (cnt[p->data] > 0) tot++;
      if (tot <= 1) ans++;
    }
  color[i] = 1;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) ge[i] = 0;
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    insertEdge(a - 1, b - 1);
  }
  memset(color, -1, sizeof(color));
  memset(flag, false, sizeof(flag));
  for (int i = 0; i < n; i++)
    if (color[i] == -1) dfs1(i, -1);
  memset(v, false, sizeof(v));
  int ans = 0;
  for (int i = 0; i < n; i++)
    if (flag[i] && !v[i]) dfs2(i, -1, ans);
  for (int i = 0; i < n; i++)
    if (!v[i]) dfs2(i, -1, ans);
  memset(color, -1, sizeof(color));
  for (int i = 0; i < n; i++)
    if (color[i] == -1) dfs3(i, -1, ans);
  printf("%d %d\n", ans, m);
  return 0;
}
