#include <bits/stdc++.h>
using namespace std;
int GCD(int x, int y) {
  if (x % y == 0)
    return y;
  else
    return (GCD(y, x % y));
}
int main() {
  int x, k, i, j, n, a, b, minCnt, maxCnt, cnt;
  int divOne[4001], divTwo[4001];
  while (scanf("%d%d", &x, &k) == 2) {
    memset(divOne, 0, sizeof divOne);
    memset(divTwo, 0, sizeof divTwo);
    minCnt = 0;
    maxCnt = 0;
    cnt = 0;
    divTwo[x] = 1;
    for (i = 1; i <= k; i++) {
      scanf("%d", &n);
      if (n == 1) {
        scanf("%d%d", &a, &b);
        divOne[b] = 1;
        divTwo[a] = 1;
      } else if (n == 2) {
        scanf("%d", &a);
        divTwo[a] = 1;
      }
    }
    for (i = 1; i < x; i++) {
      if (!(divOne[i] || divTwo[i])) {
        maxCnt++;
      }
    }
    for (i = 1; i < x; i++) {
      if (!divOne[i + 1] && !divTwo[i + 1] && !divOne[i] && !divTwo[i]) {
        divTwo[i] = 1;
        divOne[i + 1] = 1;
        cnt++;
      }
    }
    minCnt = maxCnt - cnt;
    printf("%d %d\n", minCnt, maxCnt);
  }
  return 0;
}
