#include <bits/stdc++.h>
int main(void) {
  int x, n, i;
  scanf("%d", &x);
  scanf("%d", &n);
  int div[x + 1];
  memset(div, 0, (x + 1) * sizeof(int));
  for (i = 0; i < n; i++) {
    int r;
    scanf("%d", &r);
    if (r == 1) {
      int a, b;
      scanf("%d", &a);
      scanf("%d", &b);
      div[a] = 2;
      div[b] = 1;
    } else {
      int a;
      scanf("%d", &a);
      div[a] = 2;
    }
  }
  int min = 0, max = 0;
  for (i = 1; i < x; i++) {
    if (div[i] == 0) max++;
  }
  int s = 0;
  for (i = 1; i < x; i++) {
    if (div[i] == 0) {
      s++;
    } else {
      min = min + s / 2 + (s % 2);
      s = 0;
    }
  }
  min = min + s / 2 + (s % 2);
  printf("%d %d\n", min, max);
  return 0;
}
