#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int x, k;
  cin >> x >> k;
  vector<int> v = {0, x};
  while (k--) {
    int a;
    cin >> a;
    for (int i = (0); i < (int)(3 - a); ++i) {
      int t;
      cin >> t;
      v.push_back(t);
    }
  }
  int Max = 0, Min = 0;
  sort(begin(v), end(v));
  for (int i = 0; i < v.size() - 1; ++i) {
    int d = v[i + 1] - v[i] - 1;
    Max += d;
    Min += (d + 1) / 2;
  }
  cout << Min << ' ' << Max << endl;
  return 0;
}
