#include <bits/stdc++.h>
using namespace std;
bool srt_p(const std::pair<int, int>& i1, const std::pair<int, int>& i2) {
  return i1.second < i2.second;
}
int main() {
  int x, k;
  scanf("%d%d", &k, &x);
  std::vector<std::pair<int, int> > dr(x + 1);
  for (int i = 0; i != x; ++i) {
    int m;
    scanf("%d", &m);
    if (m == 1) {
      std::pair<int, int> p;
      scanf("%d%d", &p.second, &p.first);
      dr[i] = (p);
    } else if (2 == m) {
      std::pair<int, int> ii;
      scanf("%d", &ii.second);
      dr[i] = (ii);
    }
  }
  dr[x] = std::pair<int, int>(0, k);
  std::sort(dr.begin(), dr.end(), srt_p);
  int i = 0;
  int pred = 0;
  int cur = 0;
  int acc_min = 0;
  int acc_max = 0;
  while (i != dr.size()) {
    cur = dr[i].second;
    acc_max += cur - pred - 1;
    acc_min += ceil((cur - pred - 1) / 2.0);
    if (dr[i].first) cur++;
    pred = cur;
    ++i;
  }
  printf("%d %d\n", acc_min, acc_max);
  return 0;
}
