#include <bits/stdc++.h>
using namespace std;
int a[4005] = {0};
int main() {
  int x, k;
  int ma = 0, mi = 0;
  scanf("%d%d", &x, &k);
  for (int i = 0; i < k; i++) {
    int sign;
    scanf("%d", &sign);
    if (sign == 1) {
      int c, d;
      scanf("%d%d", &c, &d);
      a[c] = 1;
      a[d] = 1;
    } else {
      int c;
      scanf("%d", &c);
      a[c] = 1;
    }
  }
  int sign = -1;
  int all = 0;
  for (int i = 1; i < x; i++) {
    if (a[i] == 0) {
      all++;
      sign = 0;
    } else if (sign == 0) {
      sign = 1;
      ma += all;
      mi += (all % 2 == 0) ? all / 2 : all / 2 + 1;
      all = 0;
    }
  }
  ma += all;
  mi += (all % 2 == 0) ? all / 2 : all / 2 + 1;
  printf("%d %d", mi, ma);
}
