#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
int main() {
  ios_base::sync_with_stdio(false);
  int x, k;
  cin >> x >> k;
  vector<pair<int, int> > v;
  while (k--) {
    int op, a, b;
    cin >> op;
    cin >> a;
    if (op == 1)
      cin >> b;
    else
      b = a;
    v.emplace_back(a, b);
  }
  v.emplace_back(x, x);
  sort(v.begin(), v.end());
  int mini = 0, maxi = 0;
  int last = 0;
  for (int i = 0; i < v.size(); i++) {
    int gap = v[i].first - last - 1;
    if (gap & 1) mini++, maxi++, gap--;
    mini += gap / 2;
    maxi += gap;
    last = v[i].second;
  }
  cout << mini << " " << maxi << '\n';
  return 0;
}
