#include <bits/stdc++.h>
using namespace std;
int s[4005], t[4005];
int main() {
  int i, j, r, x, k, op, da, db;
  scanf("%d%d", &x, &k);
  j = 0;
  for (i = 0; i < k; i++) {
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d%d", &da, &db);
      s[j++] = da, s[j++] = db;
    } else {
      scanf("%d", &da);
      s[j++] = da;
    }
  }
  sort(s, s + j);
  int pre = 1, z = 0;
  for (i = 0; i < j; i++) {
    for (r = pre; r < s[i]; r++) t[z++] = r;
    pre = s[i] + 1;
  }
  for (i = pre; i < x; i++) t[z++] = i;
  sort(t, t + z);
  int maxv = z, minv = 0;
  bool is = 0;
  for (i = 0; i < z; i++) {
    if (i) {
      if (t[i] == t[i - 1] + 1 && !is) {
        is = 1;
        continue;
      }
      is = 0;
      minv++;
    } else
      minv++;
  }
  printf("%d %d\n", minv, maxv);
  return 0;
}
