#include <bits/stdc++.h>
using namespace std;
const int maxn = 100020, maxm = 600020;
int deg[maxn], line[maxn][2], n, m;
int vis[maxn];
int main() {
  scanf("%d%d", &n, &m);
  int x, y;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x, &y);
    deg[x]++;
    deg[y]++;
    if (!line[x][0])
      line[x][0] = y;
    else if (!line[x][1])
      line[x][1] = y;
    if (!line[y][0])
      line[y][0] = x;
    else if (!line[y][1])
      line[y][1] = x;
  }
  int ans = m;
  for (int i = 1; i <= n; i++) ans -= deg[i] / 2;
  int now = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i] || deg[i] != 2) continue;
    int p = i, last;
    while (!vis[p] && deg[p] == 2) {
      last = p;
      vis[p] = ++now;
      if (vis[line[p][0]] != now - 1)
        p = line[p][0];
      else
        p = line[p][1];
    }
    vis[p] = ++now;
    if (deg[p] < 2) continue;
    while (last != p && deg[last] == 2) {
      vis[last] = ++now;
      if (vis[line[last][0]] != now - 1)
        last = line[last][0];
      else
        last = line[last][1];
    }
    if (last == p) ans++;
    now++;
  }
  printf("%d %d\n", ans, m);
  return 0;
}
