#include <bits/stdc++.h>

using namespace std;

using ll = long long;
#define x first
#define y second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

void solve();

int main() {
	cin.tie(nullptr)->sync_with_stdio(false);
	cout << fixed << setprecision(30);
	int t = 1; 
	// cin >> t;
	while (t--) {
		solve();
	}
}

const int N = 2020;
vector<int> g[N];
vector<int> used[N];

void dfs(int s) {
	used[s] = 1;
	for (int i : g[s]) {
		if (!used[i]) {
			dfs(i);
		}
	}
}

void solve() {
	int n, m;
	cin >> n >> m;
	int need = n;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v; u--; v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	for (int i = 0; i < n; i++) {
		if (!used[i]) {
			need--;
			dfs(i);
		}
	}
	cout << m - need << ' ' << 1 << '\n';
}
