#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, k, num[4002], ii[4002];
  int all = 0, max = 0, min = 0;
  memset(num, 0, sizeof(num));
  memset(ii, 0, sizeof(ii));
  scanf("%d%d", &x, &k);
  num[x] = 1;
  for (int i = 0; i < k; i++) {
    int n, a, b;
    scanf("%d", &n);
    if (n == 1) {
      scanf("%d%d", &a, &b);
      for (int j = a; j <= b; j++) {
        num[j] = 1;
        ii[j] = 1;
      }
    } else if (n == 2) {
      scanf("%d", &a);
      num[a] = 1;
      ii[a] = 1;
    }
  }
  for (int t = 1; t < x; t++) {
    if (num[t] == 0) {
      all++;
      if (ii[t] == 0) {
        max++;
        ii[t + 1] = 1;
      }
    }
  }
  printf("%d %d\n", max, all);
  return 0;
}
