#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, k, a, b, R;
  int rnds[4002];
  scanf("%d", &x);
  scanf("%d", &k);
  for (int i = 0; i < x + 2; i++) rnds[i] = 0;
  rnds[x] = 1;
  for (int i = 0; i < k; i++) {
    scanf("%d", &R);
    if (R == 1) {
      scanf("%d%d", &a, &b);
      rnds[a] = 1;
      rnds[b] = 1;
    } else {
      scanf("%d", &a);
      rnds[a] = 1;
    }
  }
  int simul = 0, maxr = 0, minr = 0;
  for (int i = 1; i <= x; i++) {
    if (rnds[i] == 0) {
      maxr++;
      simul++;
    } else if (simul > 0) {
      minr += int(ceil(float(simul) / 2.0f));
      simul = 0;
    }
  }
  printf("%d %d", minr, maxr);
  return 0;
}
