#include <bits/stdc++.h>
using namespace std;
int f2(pair<int, int> p, pair<int, int> q) { return q.first - p.second - 1; }
int f1(pair<int, int> p, pair<int, int> q) { return (q.first - p.second) / 2; }
int main() {
  int x, k;
  scanf("%d%d", &x, &k);
  vector<pair<int, int> > v;
  for (int i = (0); i < (k); i++) {
    int u, vv, w;
    scanf("%d", &u);
    if (u == 1) {
      scanf("%d%d", &vv, &w);
      v.push_back(make_pair(vv, w));
    }
    if (u == 2) {
      scanf("%d", &vv);
      v.push_back(make_pair(vv, vv));
    }
  }
  v.push_back(make_pair(0, 0));
  v.push_back(make_pair(x, x));
  sort(v.begin(), v.end());
  int mini = 0;
  int maxi = 0;
  pair<int, int> p = v[0];
  for (int i = (1); i < (v.size()); i++) {
    mini += f1(p, v[i]);
    maxi += f2(p, v[i]);
    p = v[i];
  }
  printf("%d %d\n", mini, maxi);
  return 0;
}
