#include <bits/stdc++.h>
using namespace std;
int n, k, a, b;
int p[105], id = 1;
int main()
{
cin >> n >> k;
while (k--)
{
cin >> a >> b;
if (p[a] == 0 && p[b] == 0)
p[a] = p[b] = id++;
else
p[a] = p[b] = p[a] | p[b];
}
int js = 0;
int t[105] = {}, maxt = 1;
for (int i = 1; i <= n; i++)
if (p[i] == 0)
js++;
else
maxt = max(maxt, ++t[p[i]]);
js += id - 1;
cout << js << " " << maxt;
return 0;
}