#include <bits/stdc++.h>
using namespace std;
int min_ans, max_ans, x, k, t, num1, num2, num, a[4001], i;
int main()
{
scanf("%d%d", &x, &k);
for (int i = 0; i < k; i++)
{
scanf("%d", &t);
if (t == 1)
{
scanf("%d%d", &num1, &num2);
a[num1] = 1;
a[num2] = 1;
}
if (t == 2)
{
scanf("%d", &num);
a[num] = 1;
}
}
i = 1;
while (i < x)
{
if (a[i] == 0)
{
if (i + 1 < x && a[i + 1] == 0)
{
a[i] = 1;
a[i + 1] = 1;
min_ans++;
max_ans += 2;
i+=2;
}
else {
a[i] = 1;
max_ans++;
min_ans++;
i++;
}
}
else i++;
}
printf("%d %d", min_ans, max_ans);
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKCmludCBtaW5fYW5zLCBtYXhfYW5zLCB4LCBrLCB0LCBudW0xLCBudW0yLCBudW0sIGFbNDAwMV0sIGk7CgppbnQgbWFpbigpCgp7CiAgICBzY2FuZigiJWQlZCIsICZ4LCAmayk7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IGs7IGkrKykKICAgIHsKICAgICAgICBzY2FuZigiJWQiLCAmdCk7CiAgICAgICAgaWYgKHQgPT0gMSkKICAgICAgICB7CiAgICAgICAgICAgIHNjYW5mKCIlZCVkIiwgJm51bTEsICZudW0yKTsKICAgICAgICAgICAgYVtudW0xXSA9IDE7CiAgICAgICAgICAgIGFbbnVtMl0gPSAxOwogICAgICAgIH0KICAgICAgICBpZiAodCA9PSAyKQogICAgICAgIHsKICAgICAgICAgICAgc2NhbmYoIiVkIiwgJm51bSk7CiAgICAgICAgICAgIGFbbnVtXSA9IDE7CiAgICAgICAgfQogICAgfQogICAgaSA9IDE7CiAgICB3aGlsZSAoaSA8IHgpCiAgICB7CiAgICAgICAgaWYgKGFbaV0gPT0gMCkKICAgICAgICB7CiAgICAgICAgICAgIGlmIChpICsgMSA8IHggJiYgYVtpICsgMV0gPT0gMCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgYVtpXSA9IDE7CiAgICAgICAgICAgICAgICBhW2kgKyAxXSA9IDE7CiAgICAgICAgICAgICAgICBtaW5fYW5zKys7CiAgICAgICAgICAgICAgICBtYXhfYW5zICs9IDI7CiAgICAgICAgICAgICAgICBpKz0yOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgYVtpXSA9IDE7CiAgICAgICAgICAgICAgICBtYXhfYW5zKys7CiAgICAgICAgICAgICAgICBtaW5fYW5zKys7CiAgICAgICAgICAgICAgICBpKys7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSBpKys7CiAgICB9CiAgICBwcmludGYoIiVkICVkIiwgbWluX2FucywgbWF4X2Fucyk7Cn0=