#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline int popcount(T t) {
  if (std::numeric_limits<T>::digits <=
      std::numeric_limits<unsigned int>::digits) {
    return __builtin_popcount(t);
  } else {
    return __builtin_popcountll(t);
  }
}
const long double EPS = 1e-8;
const long double PI = acosl(0.0) * 2;
struct Round {
  int div1, div2;
};
void solve() {
  int x, k;
  cin >> x >> k;
  vector<Round> r(k);
  for (int i = 0; i < int(k); ++i) {
    int type;
    cin >> type;
    if (type == 1) {
      cin >> r[i].div2 >> r[i].div1;
    } else {
      cin >> r[i].div2;
      r[i].div1 = -1;
    }
  }
  sort((r).begin(), (r).end(),
       [](const Round& a, const Round& b) { return a.div2 < b.div2; });
  int mina = 0, maxa = 0;
  r.push_back({-1, x});
  for (int i = 0; i < int(k); ++i) {
    int next = r[i + 1].div2;
    int prev = r[i].div1;
    if (prev == -1) prev = r[i].div2;
    int len = next - prev - 1;
    maxa += len;
    mina += (len + 1) / 2;
  }
  int len = r[0].div2 - 1;
  maxa += len;
  mina += (len + 1) / 2;
  cout << mina << " " << maxa << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
