#include <bits/stdc++.h>
using namespace std;
struct Node {
  int l, r;
  int val;
} node[4005];
int n;
int m;
int cmp(Node a, Node b) { return a.l < b.l; }
int main() {
  while (~scanf("%d%d", &n, &m)) {
    int type;
    for (int i = 0; i < m; ++i) {
      cin >> type;
      node[i].val = type;
      if (type == 1) {
        cin >> node[i].l;
        cin >> node[i].r;
      } else {
        cin >> node[i].l;
      }
    }
    sort(node, node + m, cmp);
    int min = 0;
    int max = 0;
    int site = 0;
    int pre = 0;
    while (site < m) {
      if (node[site].l - pre > 1) {
        min += (node[site].l - pre) / 2;
        max += node[site].l - pre - 1;
      }
      if (node[site].val == 1) {
        pre = node[site].r;
      } else {
        pre = node[site].l;
      }
      site++;
    }
    min += (n - pre) / 2;
    max += n - pre - 1;
    printf("%d %d\n", min, max);
  }
  return 0;
}
