#include <bits/stdc++.h>

using namespace std;

#define ll int
#define ve vector
#define pb push_back
ll const inf = 1e9 + 3;
ll const INF = 1e18;
#pragma GCC ("O2")

ve<bool> used;
ve<ve<ll>> edges;

void dfs(ll v) {
    used[v] = true;
    for (auto it: edges[v]) {
        if (!used[it])
            dfs(it);
    }
}

int main() {
#ifdef DEBUG_Q
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n, m, i, j;
    cin >> n >> m;
    edges.resize(n);
    for (i = 0; i < m; i++) {
        ll x, y;
        cin >> x >> y;
        x--;
        y--;
        edges[x].pb(y);
        edges[y].pb(x);
    }
    used.assign(n, false);
    ll cnt = 0;
    for (i = 0; i < n; i++) {
        if (!used[i]) {
            cnt++;
            dfs(i);
        }
    }
    cout << m - (n - cnt) << " " << 1;
}
