#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, k, q, a;
  bool r[4009] = {false};
  cin >> x >> k;
  for (int f = 0; f < k; ++f) {
    cin >> q;
    if (q == 1) {
      cin >> a >> a;
      r[a] = true;
      r[a - 1] = true;
    } else {
      cin >> a;
      r[a] = true;
    }
  }
  int summin = 0, summax = 0;
  int i = 0;
  while (i < x) {
    ++i;
    if (r[i]) continue;
    for (; i < x - 1 && !r[i] && !r[i + 1]; i += 2) {
      summin++;
      summax += 2;
    }
    if (!r[i] && i < x) ++summax, ++summin;
  }
  cout << summin << " " << summax << endl;
  return 0;
}
