#include <bits/stdc++.h>
using namespace std;
int n, m, t, x, y;
int ans1, ans2;
int l = 5000;
int a[5002];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &t);
    if (t == 1) scanf("%d%d", &x, &y), a[x] = 1, a[y] = 1;
    if (t == 2) scanf("%d", &x), a[x] = 1;
  }
  a[n] = 1;
  a[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0) ans2++;
    if (a[i] == 1 && a[i - 1] == 0) ans1 += (i - l + 1) / 2;
    if (a[i] == 0 && a[i - 1] == 1) l = i;
  }
  printf("%d %d\n", ans1, ans2);
  return 0;
}
